<SplitText> component supports both static variants (fixed animation values) and function variants (computed per element).
Basic Variants
Define named animation states and reference them by name:Variant Definitions
Each variant in thevariants prop can be:
- Flat target - Applied to the most granular split type
- Function - Returns animation properties based on element info
- Per-type object - Specific targets for chars, words, lines, wrapper
Flat Target Variant
Function Variant
Per-Type Variant
Function Variants
Function variants receive aVariantInfo object with rich positional data:
Using VariantInfo
Index vs GlobalIndex
ThedelayScope prop controls which indices function variants receive:
Global Scope (default)
UsesglobalIndex and globalCount - position across all elements:
Local Scope
Usesindex and count - position within parent group (line for chars, etc.):
Per-Type Variant Targets
Per-type variants let you animate chars, words, lines, and wrapper independently:Mixing Static and Function Targets
Combine static and function targets within a single variant:Custom Data
Pass custom data to function variants via thecustom prop:
Variant Transitions
Transitions can be defined at multiple levels with specific precedence:- Per-element function return (highest priority)
- Per-variant transition
- Global
transitionprop (lowest priority)
Complex Examples
Wave Effect
Cascading Lines
Alternating Direction
Character Reveal with Line Masks
Inline Variants
You can pass variant definitions directly to animation props without using thevariants object:
Related
- Animation Props - Complete reference for animation props
- SplitText - Main component documentation