Typewriter
ProTypes, deletes and cycles through lines with a blinking caret.
Installation
pnpm dlx shadcn@latest add @viewport/typewriter
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| text* | string | string[]One string, or several to type, delete and cycle through. | — |
| speed | numberMilliseconds per typed character. | 55 |
| deleteSpeed | numberMilliseconds per deleted character. | 28 |
| pause | numberMilliseconds to hold a finished line before deleting. | 1600 |
| loop | booleanKeep cycling through the lines. | true |
| caret | booleanShow the blinking caret. | true |
| className | string | — |
Accessibility
- Every line is exposed once to screen readers.
- Shows the first line statically under reduced motion.