Count up
stable 0.5 kB<hkCountUp>Animates a number into view and retriggers when the target changes, counting from wherever it currently is.
#directive#number
In the package
npm i hellskitchen-ui Import hkCountUp and use it directly. Live demo
Running in this page — interact with it.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| countTo | number | 0 | Target value. |
| countDuration | number | 1600 | Animation length in milliseconds. |
| countPrefix / countSuffix | string | '' | Text either side of the number. |
| countDecimals | number | 0 | Fraction digits held during the count. |
Theming
This one adds no tokens of its own — it renders entirely from the global token layer.
Accessibility
- The element is aria-live="off", so screen readers are not told about every frame of the count.
- prefers-reduced-motion jumps straight to the target.