Text Reveal
betaA word whose letters roll vertically in a staggered left-to-right wave when the text changes or on a loop.
- Effects & motion
- 1 file
- 1 npm package
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add text-revealnpm packages installed: class-variance-authority.
import { TextReveal } from "@/components/ui/text-reveal";Default
Demo
Changing Text
<TextReveal>
| Prop | Type | Default |
|---|---|---|
text (required)The text to show. Changing it rolls the old letters out and the new ones in. | string | — |
durationMilliseconds each letter takes to roll. | number | 420 |
intervalMilliseconds between rolls when looping. | number | 2000 |
loopRoll the word into itself every | boolean | false |
size | "sm" | "md" | "lg" | "md" |
staggerMilliseconds between one letter starting and the next. | number | 45 |
Plus every attribute of <span> except children.
The text is exposed once as plain text through a visually hidden copy; the per-letter rolling stage is aria-hidden, so a screen reader never spells the word out and the loop never announces anything. Under reduced motion each roll snaps to its final frame and the ambient loop does not start.
7/7
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 — does not apply
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes