Text that comes in piece by piece, by character, word or line.
Installation
Usage
import { SplittingText } from '@animate-ui/react/primitives/texts/splitting';
export function Title() {
return <SplittingText text="Splitting Text" type="words" inView />;
}Pass an array of lines with type="lines":
<SplittingText
type="lines"
text={['Introducing Splitting Text', 'Made with Motion.']}
/>Animation
- Each piece fades in and slides 150px in from the right over 0.7s on an ease-out, 0.05s apart for characters, 0.2s for words, 0.3s for lines.
initial,animateandtransitioncustomise every piece.- Words never break in the middle; emoji and accented letters stay whole.
<AnimateUIProvider tempo>paces the default transition and stagger.- Under reduced motion (or with
disableAnimation), every piece is in place at once. - Screen readers read the text once, not piece by piece.
API Reference
SplittingText
| Prop | Type | Default |
|---|---|---|
text | string | string[] | - |
type? | 'chars' | 'words' | 'lines' | 'chars' |
stagger? | number | 0.05 (chars), 0.2 (words), 0.3 (lines) |
delay? | number | 0 |
initial? | TargetAndTransition | { x: 150, opacity: 0 } |
animate? | TargetAndTransition | { x: 0, opacity: 1 } |
transition? | Transition | { duration: 0.7, ease: 'easeOut' } |
disableAnimation? | boolean | false |
inView? | boolean | false |
inViewMargin? | string | '0px' |
inViewOnce? | boolean | true |
...props? | Omit<HTMLMotionProps<'div'>, 'children' | 'initial' | 'animate' | 'transition'> | - |