Instruments Stat
// Stat

Stat

A labelled statistic cell — eyebrow, a big number that counts to its new figure, optional unit, and a slot for supporting instruments.

<talos-stat> is the atom of a console wall: an eyebrow label, a big number, an optional unit, and a default slot for supporting instruments. The one Talos idea — colour is the state. Set warn/crit and the number takes the band of its value (nominal / warning / critical); on a value change it counts to the new figure, because the honest motion for a changing magnitude depicts the transition rather than decorating it. Every attribute is reactive.

Default

LIVE
<talos-stat value="14200" label="throughput" unit="rps"></talos-stat>

label is the eyebrow caption; unit is appended after the number. With no warn/crit the band is always nominal, so the number stays in --talos-foreground.

Precision

PREVIEW
<talos-stat value="98.4" precision="1" label="uptime" unit="%"></talos-stat>
<talos-stat value="3.142" precision="3" label="latency" unit="ms"></talos-stat>

precision is the number of decimals on the displayed value (default 0); the count animation honours it the whole way.

Bands — warning & critical

PREVIEW
<talos-stat value="42" warn="60" crit="85" unit="%"></talos-stat>
<talos-stat value="72" warn="60" crit="85" unit="%"></talos-stat>
<talos-stat value="91" warn="60" crit="85" unit="%"></talos-stat>

Bands are inclusive-from: value >= crit → critical (--talos-danger); else value >= warn → warning (--talos-warning); else nominal. Only the number recolours — the label and unit stay tertiary.

Inverted — low is bad

PREVIEW
<talos-stat value="80" warn="40" crit="20" invert unit="%"></talos-stat>
<talos-stat value="32" warn="40" crit="20" invert unit="%"></talos-stat>
<talos-stat value="15" warn="40" crit="20" invert unit="%"></talos-stat>

invert flips the comparison: warning/critical trip when the value falls to/below the threshold. For “low = bad” signals — battery, coolant reserve, frame rate — a dangerously low reading reads red.

With supporting instruments

PREVIEW
<talos-stat value="14200" label="throughput" unit="rps">
  <talos-delta value="14200" good="up"></talos-delta>
  <talos-spark data="40 52 48 61 58 70 66 74" warn="60" crit="85"></talos-spark>
</talos-stat>

<talos-stat value="3" warn="4" crit="6" label="retries">
  <talos-dots value="3" total="8" warn="4" crit="6"></talos-dots>
</talos-stat>

The default slot sits under the number for sub-instruments — a <talos-delta>, <talos-spark> or <talos-dots>. The support row hides itself when the slot is empty.

Behaviour

All attributes are reactive — re-set value and it re-counts. The count snaps instantly under prefers-reduced-motion. Imperative API: el.set(value). Shares its band model (warn/crit/invert) with the other data-binding instruments.

Attributes

Generated from custom-elements.json in the installed package. Shared attributes (state, format, static…) behave as the instrument contract describes.

AttributeTypeDefaultDescription
value number — the figure; missing or non-numeric reads "—" (no data)
label string — eyebrow caption.
unit string — appended after the number.
warn number — band thresholds.
crit number — band thresholds.
invert boolean — low = bad.
duration number 500 count animation ms, at least 1.
format string — number | compact | percent | bytes | duration | currency; the readout's number format
precision string 0 decimals for the displayed value.
currency string — ISO 4217 code when format=currency
locale string — BCP 47 locale for formatting; defaults to the page locale
state string — live | loading | stale | offline | unknown; sets data-state on the host
updated-at string — time of the last sample (ISO or epoch ms); drives the age caption
stale-after string — seconds after updated-at at which the element reads stale
static string — boolean; turns motion off for this element only

Properties and methods

MemberTypeDescription
.value number | null The current reading; mirrors the `value` attribute (null = no data).
set() method Imperative setter; alias of the `value` property.

Events

EventTypeDescription
talos:band CustomEvent<BandEventDetail> Fired when the band changes (not on first render): detail { from, to, value }. Bubbles and is composed.

Slots

  • (default): Default slot.

CSS parts

::part(caption), ::part(label), ::part(num), ::part(support), ::part(unit)