Instruments Meter
// Meter

Meter

Linear level/threshold instrument — fill length is the value, fill colour is the band, warn/crit sit as ticks on the scale itself.

<talos-meter> is the horizontal analog of <talos-gauge>: fill length encodes the value, fill colour encodes the band, and the warn/crit thresholds are drawn as tick marks on the rail — so the breakpoints live on the instrument itself, not hidden in config. Colour snaps to the true band the instant the value crosses; only the length tweens.

Default

LIVE
<talos-meter value="30" warn="70" crit="90"
             label="Disk" unit="%" width="300"></talos-meter>

value over min/max (default 0/100) sets the filled fraction. The label caption sits above the rail, the unit is appended to the readout, and the two ticks mark warn and crit on the scale.

Bands — nominal / warning / critical

PREVIEW
<talos-meter
  value="34"
  warn="70"
  crit="90"
  label="Nominal"
  unit="%"
  width="300"></talos-meter>
<talos-meter
  value="78"
  warn="70"
  crit="90"
  label="Warning"
  unit="%"
  width="300"></talos-meter>
<talos-meter
  value="96"
  warn="70"
  crit="90"
  label="Critical"
  unit="%"
  width="300"></talos-meter>

A value at or past warn paints the fill (and the readout) --talos-warning; at or past crit it goes --talos-danger; otherwise --talos-success. The colour is the reading — a glance reads the band without parsing the number.

Inverted — low = bad

PREVIEW
<talos-meter value="18" warn="40" crit="20" invert
             label="Battery" unit="%" width="300"></talos-meter>

For signals where danger is a value falling — battery, coolant, frame rate — add invert: the bands trip when the value drops to/below the thresholds. Here 18 ≤ crit(20) reads critical.

Ticks off

PREVIEW
<talos-meter value="55" warn="70" crit="90" ticks="off"
             label="Bare" unit="%" width="300"></talos-meter>

Ticks draw automatically when warn/crit are set; pass ticks="off" to suppress them and keep the band colour without the scale marks.

Compact

PREVIEW
<talos-meter compact value="78" warn="70" crit="90"></talos-meter>

The compact attribute drops the caption/readout chrome down to a 3px micro-bar that stretches to its container — the honest replacement for a hand-rolled mini “progress” bar inside a dense readout row. Width follows --talos-meter-w (default 100%).

Behaviour

setAttribute("value", v) re-renders live; the fill eases toward the new value (each frame closes 18% of the remaining gap, an exponential approach) or snaps under prefers-reduced-motion. Exposes role="meter" with aria-valuenow/min/max. For the radial form see <talos-gauge>.

Attributes

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

AttributeTypeDefaultDescription
value number — current value; missing or non-numeric reads "—" (no data), bar empty at min, no band.
min number 0 domain.
max number 100 domain.
warn number — band thresholds; also drawn as ticks.
crit number — band thresholds; also drawn as ticks.
invert boolean — low = bad (the band trips as the value falls)
label string — caption above the bar.
unit string — appended to the readout.
width number 200 px; height tracks via --_h.
ticks boolean on when warn/crit set if present, draw warn/crit tick marks.
compact boolean — bare micro-bar, no caption/readout chrome.
format string — number | compact | percent | bytes | duration | currency; the readout's number format
precision string — fraction digits of the formatted 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
duration string — transition length in ms

Properties and methods

MemberTypeDescription
.value number | null The current reading; mirrors the `value` attribute (null = no data).

Events

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

CSS parts

::part(caption), ::part(fill), ::part(rail), ::part(readout), ::part(ticks)