Typewriter Text
betaTypes text a character at a time behind a blinking caret — once, on a loop, or cycling through a list.
- Effects & motion
- 1 file
- 1 npm package
- Accessibility notes
Welcome to Dowel! This is a typewriter effect.
pnpm dlx @dowel-ui/cli add typewriter-textnpm packages installed: class-variance-authority.
import { TypewriterText } from "@/components/ui/typewriter-text";Default
Gallery
Cycling
Block Caret
<TypewriterText>
| Prop | Type | Default |
|---|---|---|
children (required)One string to type, or a list to type, delete and cycle through. | string | readonly string[] | — |
asThe element to render. | TypewriterTextElement | "span" |
caret | "bar" | "block" | "none" | "bar" |
deleteSpeedMilliseconds per deleted character, for a list. Defaults to half of | number | — |
loopKeep going. A single string clears and retypes; a list cycles back to its first item. Defaults to | boolean | — |
pauseMilliseconds a finished string holds before it restarts or is deleted. | number | 1000 |
ref | Ref<HTMLElement> | — |
speedMilliseconds per typed character. | number | 50 |
startDelayMilliseconds before typing starts. | number | 0 |
Plus every attribute of <span> except ref, children.
The typed characters are aria-hidden and an sr-only copy holds the full text (every item, for a list), so a screen reader reads it once and never per character. The server renders the finished text, and the untyped remainder reserves its space so nothing reflows. Under reduced motion the full text shows immediately.
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes