Calm motion: animations on this site only fade, with no movement
CountUp
Numbers that roll to a new value
A figure that travels to its value instead of appearing: a dashboard total, a score, a price that just changed. Use it for a number the reader is meant to notice change. For the plain number everywhere else, just print it.
Basic
12,840
$128.40
- It counts from 0 when first shown (
:appear="false"starts on the value). Whenevervaluechanges, it counts on from the number that it reached. The easing is a fast start that settles. - Formatting is
Intl.NumberFormat:localepicks separators,optionsthe style ({ style: "currency", currency: "IDR" },{ style: "percent" },{ maximumFractionDigits: 1 }). odometerrolls every digit in its own column instead of counting through the values. Separators and symbols stay put.- Screen readers get the final number at once, never the count. With
prefers-reduced-motion, ordurationof 0, it just shows the value.
Usage
ts
import { BlessCountUp } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
value* | number | — | |
duration | number | 800 | milliseconds to travel from the shown number to `value` |
locale | string | — | |
options | Intl.NumberFormatOptions | — | `Intl.NumberFormat` options: `{ style: "currency", currency: "IDR" }` |
appear | boolean | true | start at 0 and count up when first shown; off shows `value` straight away |
odometer | boolean | — | roll each digit in its own column, like an odometer |