Examples
Default
Roll At Rest
Comparison
Digit Count Change
Props
AnimatedNumber
Animates a number when its value changes, either by rolling each digit like an odometer or by counting through the intermediate values. Both variants collapse to an instant swap underprefers-reduced-motion: reduce.
The rolling variant stacks all ten digits in each column, so the visual is hidden from assistive technology and the formatted value is exposed once as text instead.
number
required
The value to display. Animates whenever this changes.
number
default:"500"
Animation duration in milliseconds.
((value: number) => string)
default:"(value: number) => String(Math.round(value))"
Turns the value into the displayed string. Receives interpolated values in the
count variant, so it must handle non-integers."roll" | "count"
default:"count"
Which animation to run.
Exported types
Also exported from@fanvue/ui: AnimatedNumberProps, AnimatedNumberVariant.
Setup: Installation · Theming