Cortex

Number Ticker

A rolling digit ticker that counts to a value with per-digit stagger, padding, and blur.

$12,480

Installation

Cortexcn
pnpm dlx shadcn@latest add @cortexcn/number-ticker

Usage

import { NumberTicker } from "@/components/number-ticker";
<NumberTicker value={12480} prefix="$" locale blur />

Each digit is a column of 0 to 9 that rolls to its place. The first time the ticker scrolls into view, the digits roll in one after another; after that, a new value rolls every digit at once, so live updates never lag.

Examples

Padded

pad adds leading zeros, which suits counters and scoreboards.

012480

Behavior

  • Screen readers get the full value once, as plain text, instead of every digit.
  • With reduced motion enabled, digits jump straight to the new value with no roll or blur.
  • locale is safe in server components. format takes a function, so it only works where the ticker renders on the client.

Props

PropTypeDefaultDescription
valuenumber-The number to show, rounded to a whole number
padnumber-Pad with leading zeros to this many digits
durationnumber0.9Seconds each digit takes to roll
staggernumber0.04Seconds between digits on the first roll
startOnViewbooleantrueWait until the ticker scrolls into view
prefixstring-Text before the number, such as $
suffixstring-Text after the number, such as %
blurbooleanfalseBlur the digits briefly while they roll
localeboolean-Add thousands separators for the reader's locale
format(value: number) => string-Custom formatting, used instead of locale
classNamestring-Extra classes for the ticker
digitClassNamestring-Extra classes for each digit column

Adapted from the beUI Number Ticker (MIT).