Components

Morphing Text

A morphing text animation for React and Tailwind CSS: words melt into each other with a gooey SVG threshold filter or a soft blur crossfade. Ideal for hero headlines, it reserves the widest word so nothing shifts, keeps every word as real text for screen readers and SEO, and stays still for reduced-motion users.

  • Gooey SVG filter
  • Blur crossfade
  • No layout shift
  • SEO-friendly real text
  • prefers-reduced-motion

Design, Prototype, Build, Ship

Installation

$ npx shadcn@latest add https://duskui.com/r/morphing-text.json

Usage

hero.tsx
import { MorphingText } from "@/components/dusk/morphing-text/morphing-text"

export function Hero() {
  return (
    <h1 className="text-5xl font-bold">
      Build{" "}
      <MorphingText words={["faster", "smarter", "together"]} align="start" className="text-muted-foreground" />
    </h1>
  )
}

Examples

Inside a headline

Rendered as a span it sits inline in a sentence. align="start" keeps short words next to the text before them, and the reserved width stops the line from reflowing.

Interfaces that feel fast, fluid, effortless, yours

Gooey vs blur

gooey fuses the letters into liquid shapes and works best with bold, solid-color type. blur is a plain blur crossfade that also suits thin weights.

Design, Build, Ship, Repeat

variant="gooey"

Design, Build, Ship, Repeat

variant="blur"

API Reference

Also accepts any HTML attribute for the rendered element.

PropTypeDefaultDescription
wordsstring[]—Words or short phrases to cycle through. The first is server-rendered.
intervalnumber3000Milliseconds from one word to the next, morph included.
morphDurationnumber1000Length of the morph in milliseconds.
variant"gooey" | "blur""gooey"Threshold-filter melt, or a soft blur crossfade.
as"span" | "p" | "div" | "h1" … "h6" | "strong" | "em""span"Element to render.
align"start" | "center" | "end""center"Alignment of shorter words inside the reserved width.
reserveSpacebooleantrueReserve the widest word's width so surrounding content never moves.
announce"all" | "polite""all"Expose every word once as hidden text, or announce each new word in a polite live region.
wordClassNamestring—Classes for each word, e.g. a color.

Accessibility

  • By default every word is in the page once as visually hidden text and the animated copies are aria-hidden, so screen readers read a stable sentence and search engines index all words.
  • With announce="polite" the current word is announced each time it changes instead.
  • With prefers-reduced-motion only the first word is shown and nothing animates.
  • The cycle pauses when the text is off-screen or the tab is hidden, and the filter is removed between morphs so resting text is crisp.
  • Each word is shown for at least 600 ms before the next morph starts.