Stat

stable 1.3 kB
<hk-stat>

A metric tile with a count-up value, a delta whose tone follows its sign, and a slot for a sparkline.

#kpi#metric
In the package npm i hellskitchen-ui Import hk-stat and use it directly.

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
labelstring''Metric name.
valuenumber0Current figure.
deltanumber | nullnullChange versus the previous period; sign picks the tone.
prefix / suffixstring''Units around the value — a currency symbol, ms, %.
decimalsnumber0Fraction digits.
countUpbooleantrueAnimates the value into view.

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-stat-up#059669Positive delta colour.
--hk-stat-down#dc2626Negative delta colour.
--hk-stat-label#475569Label colour.

Accessibility

  • The delta pairs an arrow glyph with its colour, so direction is not colour-only.
  • The count-up is decorative: the final value is in the DOM from the start, so assistive tech never reads a partial number.
  • The sparkline slot is drawn in the delta colour through currentColor, so it agrees with the arrow.

More in Data