Animated counter
Give changing totals a clear sense of movement.
npx shadcn@latest add @silicon-ui/animated-counterInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/animated-counterManually
Install the dependencies
npm install motionCopy these files into your project
- components/silicon-ui/animated-counter/animated-counter.tsx
- components/silicon-ui/animated-counter/animated-counter.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
value* | number | — |
label | string | — |
prefix | string | "" |
suffix | string | "" |
decimals | number | 0 |
animateOnViewRoll every digit up from zero the first time the counter scrolls into view. | boolean | false |
localeFormatting locale. Fixed by default so server and client render the same digits. | string | "en-US" |
Dependencies
- npm
- motion
- Registry
- silicon-motion-tokens