Components
Animated Number
Numbers and amounts that count smoothly to each new value.
Import
import { AnimatedNumber, AnimatedMoney } from '@rinzai/zen';Examples
Roll
With roll, each digit rolls to its new one, like an odometer.
API reference
<AnimatedNumber>
A number that counts smoothly to each new value (and up from zero when it first appears). Rounds to whole numbers while moving, so money in minor units never shows fractions. With roll, each digit rolls to its new one instead, like an odometer: easier to read when a total changes. Instant with reduced motion.
| Prop | Type | Default |
|---|---|---|
valueRequired | number | — |
className | string | — |
durationMilliseconds per change. | number | 650 |
formatTurns the (whole) number into text, e.g. with Intl.NumberFormat. | ((value: number) => string) | — |
fromZeroCount up from zero when first shown (default), or start at the value. | boolean | true |
rollRoll each digit to its new one, like an odometer, instead of counting. | boolean | false |
<AnimatedMoney>
An amount of money (minor units) that counts to each new value.
| Prop | Type | Default |
|---|---|---|
currencyRequired | string | — |
valueRequired | number | — |
className | string | — |
durationMilliseconds per change. | number | — |
fromZeroCount up from zero when first shown (default), or start at the value. | boolean | — |
localeDefaults to the LocaleProvider's. | string | — |
rollRoll each digit to its new one, like an odometer, instead of counting. | boolean | — |
showDecimals | boolean | false |