Search

Search the site

All components

Rotating Text

Cycles through a list of strings with enter/exit motion; useful for hero lines, CTAs, and emphasis. Respects reduced motion and uses `aria-live` for screen readers.

Default
Inline rotating word inside a sentence.

Ship faster

1import { RotatingText } from "@/registry/ui";
2
3const WORDS = ["faster", "smarter", "together"] as const;
4
5export function RotatingTextDefaultExample() {
6 return (
7 <p className="text-muted-foreground text-center text-lg">
8 Ship{" "}
9 <RotatingText
10 items={WORDS}
11 intervalMs={2200}
12 className="font-semibold text-foreground"
13 />
14 </p>
15 );
16}
Highlighted phrase
Stronger styling on the rotating segment.

Design systems that feel alive

1import { RotatingText } from "@/registry/ui";
2
3export function RotatingTextInSentenceExample() {
4 return (
5 <p className="max-w-md text-center text-2xl font-medium tracking-tight">
6 Design systems that feel{" "}
7 <RotatingText
8 items={["alive", "effortless", "yours"]}
9 intervalMs={2800}
10 yOffset={8}
11 variant="highlight"
12 />
13 </p>
14 );
15}

Installation & source

Install via the shadcn CLI or copy the registry files manually.

bash
npx shadcn@latest add @tt-ui/rotating-text

Props

NameTypeDefaultDescription
itemsreadonly string[]RequiredStrings to rotate through
intervalMsnumber2400Delay between rotations in milliseconds
startIndexnumber0Initial index into items
yOffsetnumber12Vertical slide distance in px (disabled when reduced motion is preferred)
motionTransitionTransition-Optional Motion transition override
variant"default" | "highlight""default"Visual style variant for the rotating segment
classNamestring-Applied to the outer wrapper span