Skip to content
GitHub (opens in a new tab)

NumberTransition

Rolling number treatment for live metrics and counters.

stableAtomcontracts/numbertransition.json

Preview

NumberTransition

Rolling digits for live metrics and counters. Tabular numerals. Not a CountUp cousin.

Master

A count at md. Increase or Decrease to watch the digits roll. Variants shows the sizes.

12,840

Usage

Use NumberTransition for live metrics that change in place. Pass format for grouped digits. Tabular numerals keep the row stable.

Do's

  • Dashboard metrics that update in place
  • Animated count-ups with tabular numerals

Don'ts

  • Static labels without changing values
  • Non-numeric copy
<NumberTransition
  value={12840}
  format={(n) => Number(n).toLocaleString("en-US")}
/>

When to use

  • Dashboard metrics that update in place
  • Animated count-ups with tabular numerals

When not to use

  • Static labels without changing values
  • Non-numeric copy

What an agent reads

import { NumberTransition } from "agentic-ds-kit";
must
  • aria-live=polite
  • Visually hidden text carries the formatted value (or label when given); the animated digits are aria-hidden. No aria-label on the span
defaults
  • size md
stops if
  • Do not use raw hex

From contracts/numbertransition.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
valuenumber|stringYes——
formatfunctionNo——
sizesm | md | lgNomd—
labelstringNo——