Sliding Number
ProNewAn odometer: each digit rolls in its own column, with locale and currency formatting.
Installation
pnpm dlx shadcn@latest add @viewport/sliding-number
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| value* | numberThe number to display. | — |
| format | Intl.NumberFormatOptions`Intl.NumberFormat` options, e.g. `{ style: "currency", currency: "USD" }`. | — |
| locale | stringBCP 47 locale used for grouping and decimal separators. | "en-US" |
| className | string | — |
Accessibility
- Screen readers get the formatted value, not ten stacked digits.
- Tabular numerals and per-place keys keep the layout steady.
- Jumps to the value under reduced motion.