shadcn.io is an independent project built on shadcn/ui
Text
FreeRotating Text for Vue
Words roll through a window like a slot machine's reel, letter by letter. For Vue with Ark UI, when one word in a sentence should keep changing.
Rotating Text rolls one word of a sentence through its options like the reel of a slot machine: each letter of the outgoing word rolls up out of sight while the same letter of the next one rolls in behind it, one letter after the other, so a ripple runs along the word. The window fades out at its top and bottom edges, so the letters turn over a drum rather than drop off a cliff. It holds the width of its widest word, and it pauses while the pointer is over it.
Use it for the word of a headline that cycles: who a product is for, where it runs, what it does. For words that lift away and blur instead, use Flip Words; to grow a box around each word, Container Text Flip; to type them out, Typing Text. A small timer counts the turns and CSS keyframe animations the install adds to your stylesheet roll the letters, with no animation library; with reduced motion the words swap in place.
Installation
Usage
<script setup lang="ts">
import { RotatingText } from "@/components/ui/rotating-text";
</script>
<template>
<h2>
Made for <RotatingText :texts='["designers", "developers", "everyone"]' />
</h2>
</template>
Demos
Direction
direction="down" rolls the reel the other way: the next word drops in from above and the last one falls out below, like a departures board.
Stagger
stagger is the time between one letter rolling and the next, 30 ms by default. 0 rolls the whole word at once; a longer one sends a slow ripple along it, so give it a longer duration too (how long each word stays, 2500 ms by default).
Accessibility
Screen readers read every word once, as a list (designers, developers, everyone), from a visually hidden copy; the rolling letters are hidden from them, so they never hear a word change mid-sentence. The words stop while the pointer is over them, for anyone reading slowly, and with reduced motion they swap without moving.
FAQ
How is it different from Flip Words?
Both swap one word for the next, letter by letter. Rotating Text moves them like a reel, straight up through a window, the old and new letters turning over together; Flip Words lifts the old word away, growing and blurring, and raises the new one out of a blur.
Why is there space after a short word?
Rotating Text holds the width of its widest word so the sentence never jumps as the words change. In centred text the space is shared on both sides; keep the words close in length for the tightest fit.
Does it work with tight line heights?
Yes. The window reaches a little above and below the line, with margins that give the room back, so tall letters and descenders show whole even in a heading set with leading-none, and the lines around it don't move.
How do I colour the rolling word?
Give it a className, such as text-primary font-semibold: the class applies to every word, and the rest of the sentence keeps its own style.
Does it pause?
Yes, while the pointer is over it, and it waits a full duration again once the pointer leaves. With a single word it never rolls.
API Reference
RotatingText
<span> data-slot="rotating-text"
textsstring[]
The texts, shown in turn from the first; a text may be a few words.
direction?"up" | "down"
Which way the texts roll: up, the next rising from below, or down. @default "up".
- Type
"up" | "down"- Default
"up"
duration?number
How long each text stays, in milliseconds. @default 2500.
- Default
2500
stagger?number
The time between one letter rolling and the next, in milliseconds; 0
rolls the whole text at once.
- Default
30
class?string
Merged with the part's classes.
data-turn?string--rotating-text-staggerstring
The time between one letter rolling and the next (30ms).





