<SplitText> component from griffo/motion extends the React version with full Motion animation support. Use declarative variants to animate characters, words, and lines with stagger effects, scroll triggers, and viewport animations.
Import
Basic Example
Props
<SplitText> includes all React props from griffo/react plus Motion-specific animation props.
Core Props
All props from the React SplitText component are supported, including:options- Split configuration (type, classes, masking)onSplit- Callback after initial splitonResplit- Callback when text re-splitsautoSplit- Re-split on resizeviewport- Viewport observer configurationinitialStyles/initialClasses- Initial element styling
Motion-Specific Props
See the full Animation Props and Variants reference pages for detailed information on these props:Variant applied instantly after split. Can be a variant name (string) or inline variant definition.Set to
false to skip initial variant application.Variant to animate to after split. Can be a variant name or inline definition.
Named variant definitions. Each variant can target all elements or specific types (chars/words/lines/wrapper).See Variants for detailed examples.
Global transition options applied to all variant animations.See Animation Props for usage.
Variant to animate to when entering viewport.
Variant driven by scroll position. Takes priority over
animate and whileInView.Variant to animate to on hover.
Variant to animate to on tap/click.
Variant to animate to when focused.
Variant to animate to when component exits (requires AnimatePresence).Set to
false to skip exit animation.Controls how delay functions resolve indices.
global: UsesglobalIndexandglobalCount(all elements of that type)local: Usesindexandcount(elements within parent group)
Custom data passed to function variants via the
custom parameter in VariantInfo.Per-Type Variant Targets
Variants support both flat targets (applied to all split elements) and per-type targets for granular control:Function Variants
Use function variants to compute animation properties based on element position:Examples
Scroll-Triggered Animation
Hover Animation
Exit Animation with AnimatePresence
Related
- Animation Props - Complete reference for Motion animation props
- Variants - Deep dive into the variants system
- React SplitText - Base React component props