Instruments Gauge
// Gauge

Gauge

Radial gauge that renders a value's meaning — needle is the value, arc colour is the threshold band it falls in.

<talos-gauge> is a data-binding instrument: the needle angle is the value and the arc colour is the threshold band it lands in (nominal / warning / critical). Colour is the state, not a decoration applied beside it — set warn/crit and a reading that crosses them recolours the arc, needle, hub and readout at once. Every attribute is reactive; re-setting value re-renders.

Default

LIVE
<talos-gauge value="62" label="cpu" unit="%"></talos-gauge>

Single-band gauge over the default 0–100 domain. With no warn/crit the band is always nominal, so the arc stays in --talos-success. The label sets the caption under the dial; unit is appended to the readout.

Bands — warning & critical

PREVIEW
<talos-gauge value="42" warn="60" crit="85" unit="%"></talos-gauge>
<talos-gauge value="74" warn="60" crit="85" unit="%"></talos-gauge>
<talos-gauge value="92" warn="60" crit="85" unit="%"></talos-gauge>

Bands are inclusive-from: value >= crit → critical (--talos-danger); else value >= warn → warning (--talos-warning); else nominal (--talos-success).

Inverted — low is bad

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

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

Domain — custom min / max

PREVIEW
<talos-gauge
  value="3200"
  min="800"
  max="6000"
  warn="4500"
  crit="5400"
  label="rpm"></talos-gauge>

min/max set the domain the needle maps across (default 0–100). The needle fraction is (value − min) / (max − min); warn/crit are expressed in the same domain units.

Sweep — arc span

PREVIEW
<talos-gauge value="62" sweep="180" unit="%"></talos-gauge>
<talos-gauge value="62" sweep="240" unit="%"></talos-gauge>
<talos-gauge value="62" sweep="300" unit="%"></talos-gauge>

sweep is the arc span in degrees, clamped to 180–300 (default 240). The arc opens at the bottom and fills left→right across the top.

Size

PREVIEW
<talos-gauge value="62" size="96" unit="%"></talos-gauge>
<talos-gauge value="62" size="160" unit="%"></talos-gauge>
<talos-gauge value="62" size="220" unit="%"></talos-gauge>

size is the px square of the dial (default 160). Stroke, readout text, hub and the needle keep-out all scale from it, so the gauge stays legible at any size.

Behaviour

All attributes are reactive — re-set any of them and the gauge re-renders. Exposes role="meter" with live aria-valuenow/min/max. Shares its band model (warn/crit/invert) with <talos-meter>.

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), needle parked at min, no band.
min number 0 domain range.
max number 100 domain range.
warn number — value at/after which band = warning.
crit number — value at/after which band = critical.
invert boolean — low = bad (the band trips as the value falls)
label string — caption under the readout.
unit string — appended to the readout (e.g. "%")
sweep number 240 arc sweep in degrees (180–300)
size number 160 px square.
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(dial), ::part(hub), ::part(needle), ::part(readout), ::part(svg), ::part(track), ::part(value-arc)