Skip to documentation content

Word Rotate

Cycle words or short phrases in place with a slide, blur, or fade, and glide the width between them.

word-rotate-demo

Overview

Word Rotate swaps one word or short phrase for the next on a timer. The outgoing word leaves as the next one arrives, and the container glides to the new word's width so the surrounding sentence moves smoothly instead of jumping. Use it in headings to show several audiences, uses, or states without listing them all.

Three transitions are available: slide moves words up through a clipped line, blur adds a soft focus pull, and fade crossfades in place.

Installation

npx honestui@latest add word-rotate

Usage

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

<h2>
  Built for <WordRotate words={["designers", "engineers", "everyone"]} />
</h2>

Children work as well, which lets each item carry its own styling:

<WordRotate variant="blur" pauseOnHover>
  <span>Syncing</span>
  <span>Indexing</span>
  <span className="text-emerald-600">Ready</span>
</WordRotate>

Accessibility

By default, screen readers receive the full list once from a visually hidden copy, and the rotating words are hidden from them, so decorative rotation stays silent. Set announce when each change is meaningful, such as a status, to announce the current item through a polite live region instead.

With reduced motion enabled, items crossfade quickly in place without movement or blur, and the width changes instantly. Rotation continues so the content stays available; pass paused to stop it.

API Reference

PropTypeDefaultDescription
wordsReactNode[]–Items to cycle through. Children are used when omitted.
asElementType"span"Element to render.
intervalnumber2400Milliseconds each item stays.
variantslide|blur|fade"slide"Transition between items.
pauseOnHoverbooleanfalseHolds the current item while the pointer is over it.
pausedbooleanfalseStops cycling.
animateWidthbooleantrueGlides the width between items of different lengths.
announcebooleanfalseAnnounces each new item through a polite live region.
onIndexChange(index: number) => void–Called when the visible item changes.
classNamestring–Class for the root element.
itemClassNamestring–Class for each item.