Text Reveal
ProWords or characters ease in with a soft blur, on mount or on scroll.
Installation
pnpm dlx shadcn@latest add @viewport/text-reveal
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* | stringThe text to animate. Read by screen readers as one string. | — |
| as | "h1" | "h2" | "h3" | "p" | "span" | "div"Element to render. Use a heading tag for headings. | "p" |
| by | "word" | "character"Split the animation by word or by character. | "word" |
| delay | numberSeconds before the first unit starts. | 0 |
| stagger | numberSeconds between units. | 0.06 |
| inView | booleanAnimate when scrolled into view instead of on mount. | false |
| className | string | — |
Accessibility
- The full string is exposed once through aria-label; animated spans are aria-hidden.
- Renders plain text under reduced motion.
- Use the `as` prop to keep your heading hierarchy.