Components / Motion
Count Up
A number that counts up the first time it scrolls into view, with locale formatting and reduced motion support.
4,200+
Downloads
4.9
Rating
$128
Saved
Installation
npx shadcn@latest add https://jiaweing.com/r/count-up.jsonWith the @jiaweing namespace set up, use @jiaweing/count-up in place of the URL.
Usage
tsx
import { CountUp } from "@/components/count-up";tsx
<CountUp suffix="+" to={4200} />Props
CountUp
| Prop | Type | Default | Description |
|---|---|---|---|
| to | number | - | The number it lands on. |
| from | number | 0 | Where it starts. |
| duration | number | 1600 | Length of the count, in milliseconds. |
| decimals | number | 0 | Digits after the decimal point. |
| prefix / suffix | string | - | Text around the number, such as "$" or "k". |
| locale | string | - | Locale for the separators. Defaults to the browser. |
| threshold | number | 0.4 | How much must be on screen before it starts. |
| repeat | boolean | false | Count again each time it comes back into view. |
MIT licensed. Copy it, change it, ship it.