This page as markdown: /number-ticker.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

NumberTicker

Status: stable

A number that rolls to its new value digit by digit, like an odometer. Formatted with Intl.NumberFormat (currency, percent, compact, any locale); separators, signs and units hold still while each digit column turns, and a digit that appears or goes away eases its width so nothing around it jumps. At rest on first paint; under subtle or reduced motion the value simply updates.

Keywords: number, counter, odometer, rolling number, animated number, ticker, count up, stat, kpi, metric, price

Usage

Use NumberTicker for a figure that changes in place while someone is looking at it — a dashboard total after a filter changes, a live count, a price as a plan's options change, a score. The roll says "this number moved, and by roughly this much"; the reader sees the change happen instead of noticing, later, that a number is different.

Best practices

Props

Name Type Default Description
value number — The number to show. When it changes, the digits roll to it.
format Intl.NumberFormatOptions — How to write the number — { style: "currency", currency: "USD" }, { style: "percent" }, { notation: "compact" }, fraction digits. Passed to Intl.NumberFormat; an inline object is fine (it is compared by value).
locales string | string[] runtime locale BCP 47 locale(s) for the formatting. Digits roll through the locale's own numbering system.
prefix ReactNode — Before the number. A string becomes part of the number's text (and rolls in or out with it); an element is rendered as given.
suffix ReactNode — After the number ("+", " pts"). A string becomes part of the number's text; an element is rendered as given.
trend "auto" | "up" | "down" "auto" Which way the digits roll. auto rolls up as the value grows and down as it shrinks; up / down fix it (a countdown, a score that only climbs).
motion "full" | "subtle" | "off" "full" How much motion this component uses: full (default) inherits the app's policy, subtle keeps feedback and drops the flourish, off stills it. It can only turn motion down — it never overrides a reader's reduce-motion setting. The roll is expressive, so subtle updates the value in place.
className string — Merged onto the root span. Set the type tier here (text-heading-2, text-display-lg); the ticker adds tabular figures so widths hold still.
...span props Omit<ComponentPropsWithRef<"span">, "children" | "prefix"> — Remaining span attributes pass through to the root — aria-live to announce changes, id, data attributes.

Motion

Accessibility

Related

Examples

Basic

import { NumberTicker } from "@sableui/react"

<NumberTicker value={1284} className="text-heading-2" />

Currency

import { NumberTicker } from "@sableui/react"

<NumberTicker value={4280.5} format={{ style: "currency", currency: "USD" }} className="text-display-lg" />

Percent, announced

import { NumberTicker } from "@sableui/react"

<NumberTicker value={0.428} format={{ style: "percent", maximumFractionDigits: 1 }} aria-live="polite" />

Subtle

import { NumberTicker } from "@sableui/react"

<NumberTicker value={92} suffix=" pts" motion="subtle" />