Text arrives piece by piece with a staggered blur.
Installation
Install the packages
npm install @prequelui/react motion@prequelui/react reuses the primitive library your components already depend on.
Add the component
npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/splitting-text.jsonnpx shadcn@latest add https://animate.prequelui.terravidhal.me/r/splitting-text.json
Turn on the motion
npx @prequelui/cli@latest animate splitting-textThe CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.
Usage
Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.
import { SplittingText } from "@/components/prequelui/splitting-text";
export default function Demo() {
return (
<SplittingText
text="Every word arrives on time."
type="words"
stagger={0.2}
inView
className="text-3xl font-medium"
/>
);
}import { SplittingText } from "@/components/prequelui/splitting-text";
export function Variant() {
return (
<SplittingText tempo={1.2}>
…
</SplittingText>
);
}Animation
The text is cut into characters, words or lines and every piece enters on its own delay. The default entrance is a 150 px slide from the right with a fade, but initial and animate can be replaced entirely.
- Piece tween: 700 ms ease-out.
- Default stagger: 50 ms per character, 200 ms per word, 300 ms per line.
- The visual copy is hidden from assistive technology; a single label is announced.
- Reduced motion mounts the final state without travel.
API Reference
Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.
SplittingText
| Prop | Type | Default |
|---|---|---|
| text | string | string[] | — |
| type | "chars" | "words" | "lines" | "chars" |
| stagger | number | 0.05 / 0.2 / 0.3 |
| delay | number | 0 |
| inView | boolean | false |
| initial | TargetAndTransition | { x: 150, opacity: 0 } |