Rolling Number
A number whose digits roll to a new value, as an odometer, for a total, a balance or a count that changes while it is watched.
import { RollingNumber } from "@plexui/ui/components/RollingNumber";A rolling number turns each changed digit to its new value, as the wheels of an odometer do, so a total or a count that changes in front of the reader shows the change. Use it where a number moves while it is watched, such as a total as items are added; a number that only loads once needs none.
Examples
Overview
format
currency
$1,284.00
In text
3 items in your bag
API
RollingNumber
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | — | The number shown; a new value rolls each changed digit to it |
locales | Intl.LocalesArgument | "en-US" | The locale the number is written in; fixed rather than the browser's, so the server writes it as the browser does. Its own digits roll, such as Arabic-Indic |
format | Intl.NumberFormatOptions | — | How it is written: a currency, a percent, fraction digits, grouping |
className | string | — | Applied to the root span; set the size and weight here |
Other <span> attributes are forwarded to the root. The written number is in a visually hidden span; the reels are aria-hidden.
Styling
--rolling-number-duration: how long a digit rolls (defaults to600ms)--rolling-number-ease: its easing (defaults to--cubic-move)