Rolling Text
Mechanical slot-machine typography — every character is an independent clipped column rolling a vertical stack of its own glyphs into place.
Installation#
pnpm dlx shadcn@latest add @davinciui/rolling-textUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
textText content. Wraps at word boundaries; spaces keep their width. | string | "DAVINCIUI" |
patternSequential rolls every column downward in order; alternating rolls even and odd columns in opposing directions. | "sequential" | "alternating" | "alternating" |
duplicateCountRepeated copies of each glyph stacked inside its column. Travel adapts automatically. | number | 8 |
rollDurationPer-character roll duration in seconds. Eased with cubic-bezier(0.22, 1, 0.36, 1). | number | 1.4 |
staggerDelayDelay between consecutive characters in seconds. | number | 0.04 |
blurIntensityVertical motion blur during movement in px (0–20). Always resolves to 0px. | number | 3 |
autoPlayAnimate once into the final state on mount and when animation props change. When false, trigger manually through the component ref. | boolean | true |
fontFamilyFont family applied to the text. | string | "Inter, sans-serif" |
fontSizeFont size. Numbers become px; strings pass through. Roll geometry follows automatically. | number | string | 60 |
fontWeightFont weight applied to the text. | number | string | 900 |
fontStyleFont style applied to the text. | "normal" | "italic" | "normal" |
lineHeightLine height. Numbers are unitless multipliers. | number | string | 1 |
letterSpacingTracking. Numbers become px; strings pass through. | number | string | "-0.02em" |
textColorFollows the site theme (light mode: dark text, dark mode: light text). Pass an explicit color to fix it. | string | "var(--foreground)" |
backgroundColorFollows the site theme so the type masks seamlessly against the stage. Pass an explicit color (or "transparent") to fix it. | string | "var(--background)" |
textAlignText alignment. | "left" | "center" | "right" | "center" |
classNameExtra classes for the outer element. | string | — |
styleInline style overrides for the outer element. | CSSProperties | — |
Accessibility#
An sr-only span exposes the complete text while the rolling glyph copies are aria-hidden. The component has no built-in keyboard controls; autoPlay and the imperative play and reset ref methods are not focusable, and reduced-motion users see plain characters.
Motion#
Each character track rolls vertically with WAAPI transforms and an optional blur; rollDuration, staggerDelay, blurIntensity, pattern, and autoPlay control the sequence. Reduced motion is detected with matchMedia, which skips playback and renders still characters.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

