---
title: "Rolling Number"
description: "Shows a number that changes in front of people, such as a live count or a price. Each digit rolls to its new value, so people see what changed."
url: https://gelatinui.com/components/rolling-number
markdown_url: https://gelatinui.com/components/rolling-number.md
access: free
install: "npx shadcn@latest add @gelatin-ui/rolling-number"
registry_item: https://gelatinui.com/r/rolling-number.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Rolling Number

> Shows a number that changes in front of people, such as a live count or a price. Each digit rolls to its new value, so people see what changed.

Page: https://gelatinui.com/components/rolling-number

## When to use it

Best for: A number that changes in front of people: each digit rolls to its new value.

- Use it for prices, counts, and scores.
- Use `format` for currency, percent, or compact text.
- Use `trend` to pick the direction.
- Use `snap="fast"` for a readout that follows a pointer, such as a chart tooltip.

## Notes for agents

- `value` is required, a number or a `bigint`.
- It takes the font, size, and color of its parent, and has no sizes.
- It sets `tabular-nums`, so a roll never changes the width of a digit.
- No value yet is your job: show a dash, then the number.
- Pass `locale` in a server-rendered app.
- `snap` is `never` by default: each change rolls. `fast` shows the new digits at once while the value changes faster than one roll (260 ms), and rolls again after a pause. `always` never rolls.

## Anatomy

```text
RollingNumber
```

## API reference

### RollingNumber

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number \| bigint` |  | The number to show. A `bigint` keeps every digit of a value past 2^53. |
| `locale` | `string` |  | The BCP 47 locale of the digits and marks ("de-DE"). Default: the `DisplayLocaleProvider` locale, else `"en-US"` (`useDisplayLocale`). Never the browser language, so a server render and the first browser render write the same number. |
| `format` | `NumberFormatOptions` |  | The options of `Intl.NumberFormat`: `style` (`currency`, `percent`, `unit`), `notation` (`compact`), the fraction digits, `signDisplay`, `numberingSystem`, and the others. Its parts (`formatToParts`) decide the columns: each digit rolls, each other part fades. |
| `trend` | `"auto" \| "down" \| "shortest" \| "up"` | "auto" | The direction of each roll. `auto` (the default) takes it from the value: a bigger value rolls up (the new digit comes in from below), a smaller one rolls down. `shortest` turns each column the short way round on its own (a clock or a slot machine look). |
| `snap` | `"always" \| "fast" \| "never"` | "never" | When a change shows the new digits at once, with no roll and no fade. `never` (the default) rolls each change. `fast` jumps while the value changes fast (a new value less than one roll after the last, as a pointer that scrubs a chart sends), and rolls again on the first change after a pause. `always` never rolls. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| RollingNumber | `rolling-number` |  |  |  |

## Usage

Pass the value and the format.

```tsx title="plan-price.tsx"
import { RollingNumber } from "@/components/ui/rolling-number";

export function PlanPrice({ price }: { price: number }) {
  return (
    <RollingNumber
      value={price}
      locale="en-US"
      format={{ style: "currency", currency: "USD" }}
      className="text-4xl font-semibold"
    />
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/rolling-number
```

It adds 15 registry items: 14 files, 3046 lines, and the npm packages `@base-ui/react`, `clsx`, `motion`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Meter](https://gelatinui.com/components/meter.md)
- [Progress](https://gelatinui.com/components/progress.md)

## Accessibility

The number is real page text: a copy, the page HTML, and an agent read the formatted value, such as "$79".
