Split Text

Use Split Text to reveal a short heading or statement by characters, words, or lines. It uses GSAP splitting and waits for fonts before it measures line-based text.

Preview

Reduce motion:Off
Tune:Off
Inspect

Split and reveal your text with GSAP.

Installation

Basic usage

TypeScript
split-heading.tsx

Examples

Use words or lines for longer text and characters for short Latin phrases. Set scrollTrigger when the reveal should begin as the text enters the viewport.

Usage

API

PropertyTypeDefaultDescription
childrenReactNoderequiredA single text element (e.g. a heading or paragraph) to split and animate.
classNamestring—Additional CSS classes for the wrapper.
variantSplitUnit"words"Which unit the text is split into and animated.
maskbooleantrueMask each split piece (clip it) so it reveals from behind an edge instead of animating in fully visible. Masks by the same unit set in `variant`.
animationPropsgsap.TweenVars{ yPercent: 120, rotate: 5, stagger: 0.2, duration: 0.4 }GSAP tween vars merged over the defaults, e.g. `{ duration: 1.2 }`.
scrollTriggerbooleanfalsePlay the animation when the element scrolls into view instead of on mount.
startstring"top 85%"ScrollTrigger start position (only used when `scrollTrigger` is true).
autoSplitbooleanfalseRe-split on resize so line breaks stay correct. Note: this replays the animation on every resize, so it suits looping reveals more than one-shot entrances. Font-load correctness is handled automatically either way.
markersbooleanfalseShow ScrollTrigger debug markers.

Accessibility

Pass one element as the child so the component can split it safely. Reduced-motion preferences render the final text immediately.

Styling

Use a block element with a defined width for line splitting. AutoSplit remeasures lines after a resize when the layout can change.

Contact

Found a bug or need help using this component? Open an issue on GitHub.

License & Usage

Sona UI is available under the MIT license. You may use, modify, and distribute this component in personal and commercial projects.

Was this page helpful?

Your response helps us improve component docs.

Related components