Text that arrives word by word as it scrolls into view: blurring in, rising from a line, fading or wiped in.
$ pnpm dlx shadcn@latest add https://dashral.com/r/text-reveal.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/text-reveal.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/text-revealUsage
import { TextReveal } from "@/components/dashral/text-reveal"
<TextReveal as="h2" className="text-3xl font-semibold">
Dashboards and apps on a real database
</TextReveal>Examples
Variants
variant: blur, rise, fade or wipe. trigger="mount" plays it as soon as it's on the page.
API reference
TextReveal
Also takes every prop of <p>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
children | stringThe text, split into words. Required. | — |
as | "h1" … "h6" | "p" | "span" | "div"The element it renders. | "p" |
variant | "blur" | "rise" | "fade" | "wipe"Words un-blur as they rise, slide up from behind a line, or fade in; or the whole text is wiped in. | "blur" |
trigger | "view" | "mount"The first time it scrolls into view, or as soon as it's on the page. | "view" |
delay | numberMilliseconds before the first word, e.g. to follow a heading. | 0 |
stagger | numberMilliseconds between one word and the next. | 55 |
classNames | { word? }Classes for each word. | — |
className | stringExtra classes, merged with cn() so yours win. | — |
Accessibility
- The text is in the page as written, so screen readers and search engines read it whole; nothing is hidden from them.
- It renders the element you choose with as, so a heading stays a heading in the outline.
Motion
- Each word arrives a stagger after the one before, over --duration-considered on --ease-enter (rise a little longer; wipe twice as long). With reduced motion, or before scripts run, the text is simply there.