uimaxxer

Number flow

A number that rolls each digit in its own column, in the direction the value moved, while Intl handles currency, percent and compact formats and the width eases to fit.

npx shadcn@latest add @uimaxxer/number-flow
Pro
PasskeysSettings · Usage

Usage

Agent spend in November

$960.34
Day
Mon 23 Nov
Tokens
14.2M
Day on day
0.0%

Usage

import { NumberFlow } from "@/components/ui/number-flow"

const usd = { style: "currency", currency: "USD" } as const

<NumberFlow value={spend} format={usd} />

Props

PropTypeDefaultWhat it does
valuenumberThe number to show. Change it and the digits roll.
formatIntl.NumberFormatOptionsCurrency, percent, compact, signDisplay, fraction digits. Pass a stable object.
localesstring | string[]"en-US"Fixed by default so the server and the browser format the same way.
tone"none" | "sign" | "trend""none"sign colours gains and losses; trend flashes the direction of a change, then settles to ink.
direction"auto" | "up" | "down""auto"Which way the digits roll.

Accessibility

  • Screen readers get the whole formatted number as text; the rolling columns are hidden from them.
  • Reduced motion swaps the roll and the width change for a crossfade.
  • Colour is never the only signal: pair tone with signDisplay so a loss also reads as a minus.