Number Ticker
ProCounts to a value with a spring when it scrolls into view, with locale formatting.
Installation
pnpm dlx shadcn@latest add @viewport/number-ticker
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* | numberFinal value. | — |
| from | numberValue to start counting from. | 0 |
| decimals | numberDigits after the decimal point. | 0 |
| delay | numberSeconds to wait after entering the viewport. | 0 |
| prefix | string | "" |
| suffix | string | "" |
| locale | stringBCP 47 locale used for grouping separators. | "en-US" |
| className | string | — |
Accessibility
- Screen readers get the final value once, not every frame.
- Uses tabular numerals so the layout never shifts.
- Jumps straight to the value under reduced motion.