npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-number-roll.json --yesNumber roll
ProA number or a few words that roll into their new value when it changes, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- NumberRollLabelThe words beside a rolling number (its label, its sub-line)
import { NumberRoll, NumberRollLabel } from '@/components/ui/goop/number-roll';
<div className="flex flex-col gap-1">
<NumberRollLabel className="text-sm text-muted-foreground">Daily average</NumberRollLabel>
<NumberRoll value={1284} format={(n) => n.toLocaleString()} unit="ms" size="4xl" />
<p className="text-sm text-muted-foreground">
Status: <NumberRoll value="Shipped" size="inherit" announce />
</p>
</div>Change the value up or down (digits count that way) or to words (letters run forward); switch the type size, the end the reels match from, the turns, the unit and the words beside. The values are ours; under reduced motion the new value stands at once.
When to use
- A number or a few words that roll into their new value when it changes.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Number roll on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-number-roll.json --yesAdd the Goop Number roll to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { NumberRoll, NumberRollLabel } from '@/components/ui/goop/number-roll';
<div className="flex flex-col gap-1">
<NumberRollLabel className="text-sm text-muted-foreground">Daily average</NumberRollLabel>
<NumberRoll value={1284} format={(n) => n.toLocaleString()} unit="ms" size="4xl" />
<p className="text-sm text-muted-foreground">
Status: <NumberRoll value="Shipped" size="inherit" announce />
</p>
</div>- Fits: overview: body.
- Also known as: AnimatedNumber.
- width, gap, text, motion: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| size | sm | base | xl | 4xl | inherit = base | |
| value | number | string | The value shown: a number, or words. |
| format? | (value: number) => string | How a number reads: grouped digits in the document's language by default. |
| unit? | string | The words set small after the value ("ms", "notes"). |
| duration? | number | Each reel's run in milliseconds; the theme's roll duration by default. |
| stagger? | number | The milliseconds between one reel's start and landing and the next's; the theme's stagger by default. |
| spins? | number = 1 | Whole extra turns a reel makes before it lands: 1 by default; 0 rolls straight to the new character. |
| align? | 'auto' | 'start' | 'end' = 'auto' | The edge characters are matched from: auto (the default) matches a number from its end (its units stay its units) and words from their start; start or end matches either from that edge. |
| announce? | boolean = false | Says each new value in a polite live region: for a value that changes without the reader's doing. |
| Part | What it is |
|---|---|
| NumberRollLabel | The words beside a rolling number (its label, its sub-line); children: string — The words; a change crossfades to the new ones |
- Class recipes (cva): numberRollVariants (NumberRoll)
- data-slot values (to select a part by): number-roll, number-roll-label, number-roll-reel, number-roll-unit, number-roll-value
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.