Headlines that arrive word by word or letter by letter: slide, blur, hinge or rise from behind a mask, from any direction.
Rotates through a list of words, letters rising in and drifting out.
Build
Customize
Usage
import { MorphingText } from "@/components/motionkit/morphing-text";
<h1>
Build <MorphingText words={["faster", "smarter", "together"]} />
</h1>Motion
The exact curves this component runs, plotted with Motion's own maths.
Each letter
New word every 2.4s
Rotating value propositions in a hero ("for designers / developers / teams") and other short lists of alternatives.
A timer moves to the next word every interval. AnimatePresence in popLayout mode lets the outgoing word's letters drift up and blur away while the new word's letters rise in one after another. With reduced motion on, the rotation never starts and the first word stays.
Works in the App Router as is. Requires Tailwind CSS v4.
One command adds the file and installs its dependencies. Needs a components.json (run npx shadcn@latest init once if you don't have one).
npx shadcn@latest add https://www.motionkitui.com/r/morphing-text.jsonnpm install motionSave as components/motionkit/morphing-text.tsx.
"use client";
import { useEffect, useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
type MorphingTextProps = {
words: string[];
/** Seconds each word stays before the next arrives. */
interval?: number;
/** Seconds between letters as a word arrives. */
stagger?: number;
className?: string;
};
export function MorphingText({ words, interval = 2.4, stagger = 0.03, className = "" }: MorphingTextProps) {
const reduceMotion = useReducedMotion();
const [index, setIndex] = useState(0);
useEffect(() => {
// rotating text never starts for reduced-motion users: they see the first word
if (reduceMotion || words.length < 2) return;
const timer = window.setInterval(() => setIndex((current) => (current + 1) % words.length), interval * 1000);
return () => window.clearInterval(timer);
}, [reduceMotion, words.length, interval]);
const word = words[reduceMotion ? 0 : index % words.length] ?? "";
return (
<span className={`relative inline-flex ${className}`}>
<span className="sr-only">{words.join(", ")}</span>
<AnimatePresence mode="popLayout" initial={false}>
<motion.span key={word} aria-hidden className="inline-flex whitespace-pre">
{word.split("").map((letter, letterIndex) => (
<motion.span
key={letterIndex}
className="inline-block"
initial={{ opacity: 0, y: "0.4em", filter: "blur(6px)" }}
animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
exit={{ opacity: 0, y: "-0.4em", filter: "blur(6px)", transition: { duration: 0.2, delay: letterIndex * stagger * 0.5 } }}
transition={{ duration: 0.35, delay: letterIndex * stagger, ease: [0.22, 1, 0.36, 1] }}
>
{letter}
</motion.span>
))}
</motion.span>
</AnimatePresence>
</span>
);
}
| Prop | Type | Default | Description |
|---|---|---|---|
| words | string[] | — | Words to rotate through. |
| interval | number | 2.4 | Seconds each word stays. |
| stagger | number | 0.03 | Seconds between letters as a word arrives. |
How we audit: the WCAG 2.2 animation checklist and respecting reduced motion in React.
Yes. The file starts with "use client", so you can import it straight into a Server Component page or layout. It works in Vite as is, and in Astro as a React island.
Only the motion package, beside React and Tailwind CSS v4. There is no MotionKit package and no Tailwind config to add.
Yes. Run npx shadcn@latest add https://www.motionkitui.com/r/morphing-text.json in any project with a components.json. It saves the file to components/motionkit and installs its dependencies.
Reduced-motion users see the first word, with no rotation. It loops forever otherwise, so if it sits beside other content for more than 5 seconds, WCAG 2.2.2 asks you to add a pause control.
Headlines that arrive word by word or letter by letter: slide, blur, hinge or rise from behind a mask, from any direction.
Pools of colour swirl and flow inside the letters, for headings that feel alive without moving an inch.
A headline drawn in thousands of particles that gather into place, then part around the cursor and spring back.