Text Motion

Headline entrances driven entirely by your own custom Framer Motion variants.

textmotionvariantsheadlineanimationtypographycustom
Text Motion component preview

Overview

Text Motion is a React and Tailwind CSS text animation that runs your own Framer Motion variants on every word, character, or line of a headline, in Next.js or any React app. Pass hidden and show variants and it splits the string, staggers the pieces across one duration, and starts on mount or when scrolled into view, once or every time. The as prop keeps the element a real heading, and screen readers get the whole string while the animated pieces stay hidden from them. Reduced motion renders the settled show state with no stagger.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add text-motion

Usage

Import TextMotion from @/components/wensity/text-motion and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { TextMotion } from "@/components/wensity/text-motion";
import type { Variants } from "framer-motion";
const variants: Variants = {
hidden: { opacity: 0, y: 20, rotate: 3, scale: 0.95 },
show: {
opacity: 1,
y: 0,
rotate: 0,
scale: 1,
transition: { type: "spring", damping: 12, stiffness: 200 },
},
};
export default function Example() {
return (
<TextMotion
as="h1"
text="Wavy Motion!"
by="character"
variants={variants}
className="font-display text-4xl font-semibold"
/>
);
}

Props

PropTypeDefaultDescription
textstring-The string to animate.
variantsVariants-Framer Motion variants with hidden / show keys for each segment.
by"text" | "word" | "character" | "line""word"How to split the string for staggering.
as"p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6""p"Tag rendered as the outer element.
durationnumber0.3Stagger = duration / segment count.
delaynumber0Delay before the cascade starts, in seconds.
startOnViewbooleanfalseWhen true, wait for viewport entry. When false, play on mount.
oncebooleantruePlay only once when using viewport trigger.

Featured in React hero section components.