Skip to content

Word Rotate

Motion

Rotates words inside a sentence: the old word lifts and blurs away as the next rises in. The slot keeps the widest word's width so the line never jumps.

src/registry/premium/word-rotate.tsx/r/word-rotate.json

Installation

bash
npx shadcn@latest add @minidev/word-rotate

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/word-rotate.json

Usage

tsx
import { WordRotate } from "@/components/ui/word-rotate"

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

API reference

WordRotate props
PropTypeDefault
wordsWords to cycle through, in order.string[]["startups", "agencies", "fintech", "...
intervalMilliseconds each word stays.number2200
classNamestring-
prefixText before the rotating word.React.ReactNode"Interfaces for"

When to use

Use it for a hero line like "Interfaces for <rotating word>". Reach for MorphingText to cycle whole phrases, TypingText for a typewriter, and HyperText or TextScramble for a one-off decode.

Accessibility

  • The full word list is in an sr-only span and the animated slot is aria-hidden, so changes are never announced one by one.
  • It only rotates while half of it is in view.
  • Under reduced motion it shows the first word and never changes.

Frequently asked questions

Will the rotating word make the sentence jump?

No. Every word is rendered invisibly in the same slot, so it is always as wide as the longest word. Long words in the list make a wide gap after short ones, so keep them a similar length.

Can I use WordRotate inside an h1?

Yes, it renders a <span>. Screen readers hear the prefix and then the full list, such as "Interfaces for startups, agencies, fintech", so the heading still makes sense.

Dependencies

npm

motion

Built from

No other MiniDev files

Examples

Custom words

Pass words and a prefix; the slot keeps the width of the longest word so nothing jumps.

Faster interval

interval is the time each word stays in milliseconds; keep it above a second for reading.

Inside a headline

Size it with className and drop the prefix to use the slot in the middle of your own sentence.

All Animated React components

Learn more