Number Animation

Animated number primitives for count-up values, rolling tickers, and fixed-slot digit swaps.

Digit Swap

digit-swap.tsx

Fixed-slot digits and mask glyphs that roll on change with controllable direction, stagger, replay, and suffix emphasis.

Card number•••• •••• •••• 0806

Install

$ bunx --bun shadcn add @beui/digit-swap

API Reference

value
string | number

Numeric or masked value rendered in fixed character slots.

animationKey?
string | number

Replays every glyph when the value itself contains unchanged characters.

direction?
"up" | "down"

Direction the next glyph enters from.

up
duration?
number

Per-glyph transition duration in seconds.

0.18
stagger?
number

Delay in seconds between neighboring glyphs.

0.006
suffixLength?
number

Number of final characters that receive `suffixClassName`.

0
className?
string
glyphClassName?
string
suffixClassName?
string

Number Ticker

number-ticker.tsx

Slot-machine rolling digits with staggered entry.

Active users

48,273

live · updates every 2.5s

Install

$ bunx --bun shadcn add @beui/number-ticker

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 locale group separators (commas). Server-component safe.

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

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

Animated Number

animated-number.tsx

Spring-driven count-up triggered when in view.

Monthly recurring revenue

$0

+12.4% vs last month

Install

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

API Reference

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

Updated