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

NameTypeDefaultDescription
countTonumber0Target value.
countDurationnumber1600Animation length in milliseconds.
countPrefix / countSuffixstring''Text either side of the number.
countDecimalsnumber0Fraction 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.

More in Utility