<SplitText> component, extracted from SplitTextProps interface.
Core Props
The single child element to split. Must be a valid React element (like
<h1>, <p>, etc.).Configuration options for text splitting behavior.Available options:
type- Split type:"chars","words","lines", or combinations like"chars,words,lines"charClass- CSS class for character spanswordClass- CSS class for word spanslineClass- CSS class for line spansmask- Apply overflow mask wrapper:"lines","words", or"chars"resplitDebounceMs- Debounce delay for resize-triggered resplits (default:100ms,0disables)propIndex- Adddata-indexattribute to split elementsdisableKerning- Skip kerning compensation (no margin adjustments)
Callback Props
Called after text is split. Return an animation or promise to enable automatic revert with The callback receives:
revertOnComplete.chars- Array of character spanswords- Array of word spanslines- Array of line spansrevert- Function to manually revert to original HTML
Called when
autoSplit triggers a full re-split (e.g., on window resize). Use this to re-apply animations to new elements.Called when element enters viewport (requires
viewport prop or any viewport-related prop). Return an animation for revertOnComplete support.Called when element leaves viewport.
Called when split text is reverted to original HTML (manual or automatic via
revertOnComplete).Viewport Props
Viewport observer options matching Motion’s viewport API. Configures IntersectionObserver behavior.Available options:
once- Only trigger once (default:false)amount- Visibility threshold:number(0-1),"some", or"all"(default:0)leave- Visibility required to consider element out of view (default:0)margin- Root margin for IntersectionObserver (default:"0px")root- Root element ref for IntersectionObserver
Re-apply
initialStyles and initialClasses when element leaves viewport. Useful for scroll-triggered animations that should reset.Styling Props
Apply initial inline styles to split elements after splitting and kerning compensation. Can be a static style object or a function receiving
(element, index).Apply initial CSS classes to split elements after splitting. Classes are added via
classList.add() and support space-separated class names.Behavior Props
Enable automatic re-splitting on window resize. Triggers
onResplit callback with new elements.Automatically revert to original HTML after animation promise resolves. Requires
onSplit or onViewportEnter to return an animation or promise.Wait for
document.fonts.ready before splitting. Set to false to split immediately (may cause FOUC).Wrapper Props
The HTML element type for the wrapper container.
CSS class name for the wrapper element.
Additional inline styles for the wrapper element (merged with internal styles).
Forward ref to the wrapper element.