Animated Number

Counts up to a number when it scrolls into view.

1,842Tasks done
312.5Hours saved
98.6%On time

Installation

pnpm dlx shadcn@latest add @paneui/animated-number

Usage

Examples

Live Updates

Start Value

Spring

Motion

With reduced motion the number jumps to its value without counting. Screen readers get the final formatted value from a visually hidden copy.

Number Ticker rolls each digit like an odometer instead.

API Reference

AnimatedNumber

A formatted number that counts to value on a spring. Also accepts every prop of span.

value*
number
The number to count to.
from= 0
number
Where the count starts on first reveal.
locale= runtime locale
string
Locale for Intl.NumberFormat.
format
Intl.NumberFormatOptions
Currency, percent, compact, fraction digits and so on.
startOnView= true
boolean
Wait until half the number scrolls into view before counting.
stiffness= 380
number
Spring stiffness; higher settles faster.
damping= 42
number
Spring damping; the default is slightly overdamped so the count never overshoots, and lower values overshoot the target.
mass= 0.7
number
Spring mass.
PropTypeDefaultDescription
value*number—The number to count to.
fromnumber0Where the count starts on first reveal.
localestringruntime localeLocale for Intl.NumberFormat.
formatIntl.NumberFormatOptions—Currency, percent, compact, fraction digits and so on.
startOnViewbooleantrueWait until half the number scrolls into view before counting.
stiffnessnumber380Spring stiffness; higher settles faster.
dampingnumber42Spring damping; the default is slightly overdamped so the count never overshoots, and lower values overshoot the target.
massnumber0.7Spring mass.
data-slot
"animated-number"
Data attributeDescription
data-slot"animated-number"