Skip to content

Morphing Text

Motion

React headline that cycles through phrases by blurring one into the next on two stacked layers, pauses off screen and shows the first phrase for reduced motion.

src/registry/premium/morphing-text.tsx/r/morphing-text.json

Installation

bash
npx shadcn@latest add @minidev/morphing-text

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/morphing-text.json

Usage

tsx
import { MorphingText } from "@/components/ui/morphing-text"

export function Example() {
  return (
    <MorphingText />
  )
}

API reference

MorphingText props
PropTypeDefault
wordsstring[]["Invoices that close themselves", "R...
intervalMilliseconds each phrase is held before it melts into the next.number2600
durationSeconds one morph takes.number1
classNamestring-

When to use

Use it for one hero headline that cycles a few phrases. Reach for WordRotate to swap a single word inside a sentence, TypingText for a typewriter, and TextScramble for a one-off decode.

Accessibility

  • Screen readers get every phrase once, joined with full stops, from an sr-only span. The animated layers are aria-hidden.
  • Under reduced motion it shows the first phrase and never changes.

Frequently asked questions

Will MorphingText make the layout jump?

No. Every phrase is rendered invisibly in the same grid cell, so the slot is always as tall as the longest phrase at the current width. Content below it never moves.

Can I use it as an h1?

Not as is. It renders a <p>, which cannot sit inside an <h1>, so change the tag in the file or keep your <h1> separate. Screen readers hear every phrase joined, such as "Invoices that close themselves. Reports that write themselves.", which is long for a page title.

How do I make the morph slower?

interval is how long each phrase holds in milliseconds (default 2600), and duration is the length of each morph in seconds (default 1). It pauses when less than 40% is in view.

Dependencies

npm

motion

Built from

No other MiniDev files

Examples

Custom phrases

Pass words in order; the slot reserves the height of the tallest phrase so nothing below it moves.

Quick cycle

interval is the hold in milliseconds and duration the melt in seconds; short words can go faster than sentences.

Left aligned in a hero

Override the centring and size with className to use the morph as the first line of a left aligned hero.

All Animated React components