Skip to content

Number flow

A number whose digits roll to their new value.

format takes the options of Intl.NumberFormat; prefix and suffix add text that does not roll. trend sets which way the digits turn: auto follows the change, up and down always turn one way, shortest takes the shorter way round. When the person prefers reduced motion, or with animated={false}, the new value is shown at once.

Counter

+2 days

Formats

Invoiced
€184,200
Growth
+8.2%
Visits
96K
Response
~240 ms

Rolling direction

auto
27
up
27
down
27
shortest
27
still
27

Installation

npx shadcn@latest add @khaeli/number-flow

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

Accessible name

  • The rolling digits are hidden from assistive technology. A visually hidden copy holds the whole formatted value with its prefix and suffix, so the number is read as written: +2 days.
  • A change is not read out by itself. Put the number in an aria-live="polite" element when a person needs to hear the new value.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/number-flow.json