Skip to content
Browse docs and components

Number Flow

number-flow

A number whose digits roll like an odometer when it changes, so only the digits that changed move. Formatting comes from Intl, so currency signs and separators stay put, and screen readers hear the value once.

Responsive

Install

$npxshadcnadd@forme/number-flow

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

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

<NumberFlow value={total} format={{ style: "currency", currency: "USD" }} />

When to use

Reach for it

  • Live figures that change in place — a price as the plan changes, a running total, a counter.
  • Places where seeing which digits changed is the point.

Use something else

  • A number that changes many times a second; it would roll constantly and read as noise.
  • A figure that only appears once. NumberTicker counts up on first view instead.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

NumberFlow

A number whose digits roll like an odometer when it changes.

PropTypeDefaultDescription
value*number—
formatIntl.NumberFormatOptions—
localeIntl.LocalesArgument"en-US"

Also takes every prop of <span> attributes.

Accessibility

  • The rolling digits are hidden from assistive technology, and the formatted value is rendered once for it.

Motion

  • Each digit is a column that slides to its value, so only the digits that changed move.
  • Separators, currency signs and suffixes come from Intl.formatToParts and stay in place.
  • Reduced motion turns the roll into a cut.