Modus UI

Split Text

Web (React)

Staggered text animations splitting by characters, words, or lines.

Staggered text animations splitting by characters, words, or lines. A native Framer Motion implementation that achieves the same beautiful effect as GSAP's premium SplitText plugin without the cost or bundle size.

The details are not the details.

They make the design.

Installation

CLI

npx @modus-ui/cli add split-text

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/split-text.tsx.
  3. Paste the code.

Usage

tsx
import { SplitText } from "@/components/ui/split-text";

export default function Example() {
  return (
    <SplitText
      text="The details are not the details."
      delay={0.03}
      splitType="chars"
      className="font-serif text-3xl"
    />
  );
}

Props

PropTypeDefaultDescription
textstring-The text to animate.
delaynumber0.05Seconds between each segment.
durationnumber0.5Seconds each segment animates for.
splitType"chars" | "words" | "lines""chars"How the text is split into segments.
thresholdnumber0.1Fraction visible before the animation starts.
textAlign"left" | "center" | "right" | "justify""center"Text alignment.
asReact.ElementType"p"Element to render as.

Comments

  • No comments yet.