Letters that spin like slot reels and lock into a headline
| Name | Type | Default | Description |
|---|---|---|---|
text | string | "Your lucky number" | The headline. Changing it rolls the reels to the new words, so it works as a rotating headline. |
as | "span" | "div" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "span" | Element to render. Screen readers get the plain text. |
fontSize | number | string | "clamp(2.75rem, 8vw, 6.5rem)" | Font size. Numbers are pixels; strings accept any CSS length. |
fontWeight | number | 700 | Font weight. The font family is inherited from the page. |
letterSpacing | string | "-0.03em" | Letter spacing as a CSS length. |
lineHeight | number | 1.1 | Line height, which is also the height of each reel's window. |
align | "left" | "center" | "right" | "center" | Text alignment. |
color | string | inherited | Text colour. Leave unset to inherit from the page. |
accentColor | string | "#B15CFF" | Colour each letter flashes as its reel locks in, fading back to the text colour. |
charset | string | "auto" | Glyphs on the reels. "auto" matches each letter: capitals spin through capitals, lowercase through lowercase, digits through digits, all picked to the same width. Any other string is used as-is. |
trigger | "view" | "mount" | "manual" | "view" | When the first spin plays: as the headline scrolls into view, as soon as it mounts, or only through the ref. |
direction | "left" | "right" | "center" | "edges" | "random" | "left" | Order the reels stop in. |
spinSpeed | number | 22 | Glyphs per second while a reel spins at full speed. |
duration | number | 0.5 | Seconds the reels spin before the first one stops. |
stagger | number | 0.06 | Seconds between one reel stopping and the next. |
bounce | number | 0.45 | How much a reel overshoots and settles as it locks in, from 0 to 1. |
blur | number | 0.6 | Vertical motion blur on fast-spinning reels, from 0 to 1. |
fade | number | 0.7 | Shading at the top and bottom of each reel window while it spins, from 0 to 1. |
flash | number | 0.6 | Strength of the accent flash when a reel locks in, from 0 (none) to 1. |
loop | boolean | false | Spin again every interval while the headline is on screen. |
interval | number | 4 | Seconds between spins when loop is on. |
flickable | boolean | true | Grab a letter and flick it up or down: its reel spins with your momentum and always lands back on the right letter. Mouse and pen only, so touch scrolling is never captured. |
clickToSpin | boolean | true | Clicking or tapping the headline pulls the lever and spins every reel. |
spinOnHover | boolean | false | Spin every reel when the pointer enters. |
onComplete | () => void | — | Called when the last reel locks in. |
ref | { spin } | — | spin() pulls the lever from code. |
className | string | — | Classes for the root element. |
style | CSSProperties | — | Inline styles for the root element. |
textstringThe headline. Changing it rolls the reels to the new words, so it works as a rotating headline.
"Your lucky number"as"span" | "div" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6"Element to render. Screen readers get the plain text.
"span"fontSizenumber | stringFont size. Numbers are pixels; strings accept any CSS length.
"clamp(2.75rem, 8vw, 6.5rem)"fontWeightnumberFont weight. The font family is inherited from the page.
700letterSpacingstringLetter spacing as a CSS length.
"-0.03em"lineHeightnumberLine height, which is also the height of each reel's window.
1.1align"left" | "center" | "right"Text alignment.
"center"colorstringText colour. Leave unset to inherit from the page.
inheritedaccentColorstringColour each letter flashes as its reel locks in, fading back to the text colour.
"#B15CFF"charsetstringGlyphs on the reels. "auto" matches each letter: capitals spin through capitals, lowercase through lowercase, digits through digits, all picked to the same width. Any other string is used as-is.
"auto"trigger"view" | "mount" | "manual"When the first spin plays: as the headline scrolls into view, as soon as it mounts, or only through the ref.
"view"direction"left" | "right" | "center" | "edges" | "random"Order the reels stop in.
"left"spinSpeednumberGlyphs per second while a reel spins at full speed.
22durationnumberSeconds the reels spin before the first one stops.
0.5staggernumberSeconds between one reel stopping and the next.
0.06bouncenumberHow much a reel overshoots and settles as it locks in, from 0 to 1.
0.45blurnumberVertical motion blur on fast-spinning reels, from 0 to 1.
0.6fadenumberShading at the top and bottom of each reel window while it spins, from 0 to 1.
0.7flashnumberStrength of the accent flash when a reel locks in, from 0 (none) to 1.
0.6loopbooleanSpin again every interval while the headline is on screen.
falseintervalnumberSeconds between spins when loop is on.
4flickablebooleanGrab a letter and flick it up or down: its reel spins with your momentum and always lands back on the right letter. Mouse and pen only, so touch scrolling is never captured.
trueclickToSpinbooleanClicking or tapping the headline pulls the lever and spins every reel.
truespinOnHoverbooleanSpin every reel when the pointer enters.
falseonComplete() => voidCalled when the last reel locks in.
—ref{ spin }spin() pulls the lever from code.
—classNamestringClasses for the root element.
—styleCSSPropertiesInline styles for the root element.
—