Number Roll

View registry JSON

Numbers that move with their value. Each changing digit rolls into place, with support for currency, compact notation, and live counters.

Install with the shadcn CLI

npx shadcn@4.21.5 add @cavemio/number-roll
First install? Configure @cavemio once

Run npx shadcn@4.21.5 init if shadcn is not set up, then merge this entry into the registries field in your existing components.json. Keep your other settings and registries.

components.json
{
  "registries": {
    "@cavemio": "https://registry.cavemio.dev/r/cavemio-{name}.json"
  }
}

Overview

Numbers that move with their value. Each changing digit rolls into place, with support for currency, compact notation, and live counters.

Demo values are local; no network requests.

import { NumberRoll } from "@/components/number-roll";

<NumberRoll value={1248} locales="en-US" />
<NumberRoll
  value={49}
  format={{ style: "currency", currency: "USD" }}
/>

Props

PropTypeDescription
valuenumberThe number to display.
formatIntl.NumberFormatOptionsCurrency, percent, decimals, compact notation or grouping.
localesstring | string[]Locale used to format the number.
prefix / suffixstringText placed before or after the formatted number.
fromnumberOptional starting value for the initial count-up.
durationnumber · 900Roll duration in milliseconds.
direction"up" | "down"Override the direction inferred from value changes.