Number tween
A number that eases to its new value instead of jumping.
$51,890
When to use
- A figure updates and the change should be easy to follow.
When not to use
- The exact value must be readable at every instant.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/number-tween
Adds its 3 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
NumberTween
8 props
PropTypeDefaultDescription
value *number—
formatNumberFormatOptions—
localestring"en-US"
prefixstring""
suffixstring""
durationnumber500Milliseconds for a full count. Small changes finish sooner.
animateOnViewbooleanfalseCount up from zero the first time the number scrolls into view.
classNamestring—
Keyboard
- No custom key handling; Tab and the native activation keys do the work.
Accessibility
It is built on native elements and keeps aria-live and aria-hidden in step with state. Changes that matter are announced through a live region.
Motion
- State changes animate with the library's shared durations and curves, so its timing matches every other part.
- Under reduced motion each change lands on its end state without movement; nothing is hidden or skipped.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/number-tween.mdThe index of every part is at /llms.txt.