Rotating Words
ProCycles through words in place without shifting the text around it.
Installation
pnpm dlx shadcn@latest add @viewport/rotating-words
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| words* | string[]Words to cycle through. | — |
| interval | numberMilliseconds each word stays on screen. | 2200 |
| className | string | — |
Accessibility
- All words are announced once as a list; the animation is aria-hidden.
- Reserves the width of the longest word to prevent layout shift.
- Stops rotating under reduced motion.