React Splitting Text
React text splitting with staggered character, word, or line reveals. Smooth animations that flow naturally using Framer Motion, TypeScript, and shadcn/ui.
Powered by
Trying to implement text animations?
Join our Discord community for help from other developers.
Ever tried to animate text revealing and it either all pops in at once (boring) or staggers so slowly it feels like watching paint dry? Most split text animations either have terrible timing or split at weird places, making sentences look broken. This component gets the rhythm right—characters flow smoothly, words feel natural, lines cascade properly.
Character-by-character reveals with perfect timing
Text that splits and reveals with natural stagger patterns:
Built with TypeScript and shadcn/ui, using Framer Motion for precise stagger control in React applications. Whether you split by character, word, or line, the timing feels natural and the text maintains proper spacing and flow throughout the animation.
Installation
npx shadcn@latest add https://www.shadcn.io/registry/splitting-text.json
npx shadcn@latest add https://www.shadcn.io/registry/splitting-text.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/splitting-text.json
bunx shadcn@latest add https://www.shadcn.io/registry/splitting-text.json
Usage
import { SplittingText } from "@/components/text/splitting-text";
<SplittingText
text="Smooth text reveals that actually work"
type="words"
inView={true}
motionVariants={{
initial: { opacity: 0, x: 100 },
animate: { opacity: 1, x: 0 },
transition: { duration: 0.5 },
stagger: 0.1
}}
/>;
Why most split text animations suck
Most developers just throw a delay on each element without considering how humans actually read. Characters that appear too fast blur together, too slow feels broken. Words that split randomly break readability. Lines that cascade without rhythm look like a broken marquee.
This React component uses different stagger timings for each split type: 50ms for characters (fast enough to feel smooth), 200ms for words (time to process each one), 300ms for lines (dramatic without dragging). We preserve proper spacing and line breaks so text never looks broken during animation.
The motion variants are customizable but the defaults were tested for readability. Text slides in from the right with opacity fade, matching how eyes naturally scan left-to-right. No bouncing, no rotating, no effects that compete with actual reading.
Examples
Word-by-word reveals
Perfect timing for headlines and taglines:
Line-by-line cascading
Dramatic reveals for poetry or step-by-step content:
Custom animation variants
Fully customizable motion for brand-specific effects:
Features
- Three splitting modes optimized for different content types in React applications
- Stagger timing that matches natural reading rhythm and comprehension
- Custom motion variants with complete animation control for JavaScript projects
- In-view detection so animations trigger when users actually see them
- Complete TypeScript support with full motion variant type definitions
- Preserves text formatting and whitespace during all animation states
- Free open source component that works seamlessly with shadcn/ui in Next.js
API Reference
SplittingText
Text animation with character, word, or line splitting options.
Prop | Type | Default | Description |
---|---|---|---|
text | string | string[] | required | Text or array of lines to animate |
type | 'chars' | 'words' | 'lines' | 'chars' | How to split text for animation |
motionVariants | MotionVariants | - | Custom Framer Motion variants |
inView | boolean | false | Only animate when visible |
inViewMargin | string | "0px" | Viewport margin for trigger |
inViewOnce | boolean | true | Animate only once |
delay | number | 0 | Start delay in milliseconds |
className | string | - | Additional CSS classes |
...props | HTMLAttributes<HTMLDivElement> | - | Standard div attributes |
Motion Variants Interface
Customize how text elements animate:
motionVariants?: {
initial?: Record<string, any>; // Starting state
animate?: Record<string, any>; // Final state
transition?: Record<string, any>; // Timing config
stagger?: number; // Override default stagger
}
Optimal Stagger Timing
Tested values for natural reading flow:
Split Type | Default Stagger | Reading Speed | Best For |
---|---|---|---|
chars | 0.05s | Fast | Headlines, short phrases |
words | 0.2s | Natural | Sentences, taglines |
lines | 0.3s | Dramatic | Poetry, step lists |
Common gotchas
Text looks broken during animation: Make sure the container has enough width in React applications. Character splitting with narrow containers causes weird wrapping during the reveal.
Stagger timing feels wrong: Default timings work for English text with TypeScript optimization. Other languages or very long text might need custom stagger values. Test with actual content, not Lorem ipsum.
Animation performance issues: Each character/word/line creates individual animated elements in JavaScript applications. Very long text (500+ words) might be slow on older devices—consider splitting into smaller chunks.
Whitespace disappears: The component preserves spacing, but custom CSS might override it in Next.js projects. Check for white-space
or word-spacing
styles that could interfere.
Lines don't break properly: For line splitting, pass an array of strings, not a single string with \n
characters. Each array item becomes one animated line.
Related text components you will also like
Text Generate Effect
Progressive character generation with realistic typing timing
Writing Text
Word-by-word reveals with natural reading rhythm and flow
Text Reveal
Cinematic text reveals with clip-path and mask animations
Blur Text
Text that animates from blur to focus with intersection observer
Rolling Text
3D character rolling with realistic physics and perspective
Shuffle
Random character shuffling with smooth settling animations
Questions developers actually ask
React Sliding Number
React sliding number component with digit-by-digit animations. Smooth mechanical counter effects with spring physics using Motion, TypeScript, and shadcn/ui.
React Text Cursor Trail
Interactive cursor trail effect that leaves animated text or emojis following mouse movement with customizable spacing and floating animations.