AnimatedNumber
Animated number that counts up like an odometer.
A faithful port of Motion+'s AnimateNumber: each digit is a full 0–9 column
that rolls through the intermediate numerals to its new value (a FLIP spring
on y), the leading digit rolls up from zero as magnitude grows, and section
widths animate so proportional fonts stay aligned. Formatting (grouping,
fraction digits, currency, sign) comes from Intl.NumberFormat; the token
duration / easing drive the timing, or pass transition for a bespoke
curve/spring. Use prefix / suffix for units and currency so they align
with the digits and fold into the single screen-reader announcement.
Usage
Best practices
Needs
ReducedMotionProviderin the app tree - it supplies the LazyMotiondomMaxfeatures the digit roll and layout animations require, and itsreducedMotion="user"makes the number snap to its final value for users who ask for less motion.Use
prefix/suffixfor units and currency ($,/10), not sibling text nodes - they're layout-animated with the digits and folded into the one screen-reader announcement.Reach for the
duration/easingtokens over a rawtransition- token timing keeps it in step with the rest of the motion system; drop totransitiononly for bespoke springs.
Props
Also exports
- interface
AnimatedNumberProps - type
AnimatedNumberTrend
Composition
Builds on
Used by