Number Animation

Two ways to animate figures on dashboards and pricing pages: AnimatedNumber eases up to its value, optionally once it scrolls into view, and NumberTicker spins each digit like an odometer with prefix, suffix and en-US grouping.

Number Ticker

number-ticker.tsx

Every digit spins into place on its own reel, each starting a beat after the last; supports zero padding, prefix, suffix, comma grouping and an optional blur mid-roll. Screen readers get the formatted number as plain text.

Number Animation Number Ticker preview width

Install

$ bunx --bun shadcn add @karaui/number-ticker
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

value
number
—
pad?
number

Digits to pad to (left).

—
duration?
number

Per-digit roll duration in seconds.

0.9
stagger?
number

Stagger between digits.

0.04
startOnView?
boolean

Render only after the element enters the viewport.

true
prefix?
string
—
suffix?
string
—
blur?
boolean

Add a small blur during digit rolls.

false
className?
string
—
digitClassName?
string
—
locale?
boolean

Insert en-US group separators (commas); fixed so server and client match. Server-component safe.

—
format?
((value: number) => string)

Custom formatter. Client-only — server components must use `locale` instead.

—

Animated Number

animated-number.tsx

Eases from the previous value to the new one through a format function you provide; with startOnView it waits until most of the element is on screen before counting.

Number Animation Animated Number preview width

Install

$ bunx --bun shadcn add @karaui/animated-number

API Reference

value
number
—
duration?
number
1.2
format?
((n: number) => string)
(n) => Math.round(n).toLocaleString("en-US")
className?
string
—
startOnView?
boolean
true

Updated