Instruments Odometer
// Odometer

Odometer

A rolling running total where the digit motion is the throughput: the ones place blurs, the high digits sit still.

<talos-odometer> is a big running counter (requests served, bytes moved, events processed) where every digit that changes rolls from its old glyph to the new one. A fast counter therefore looks fast: its low-order digits roll continuously while the high-order digits sit still, and a stalled counter is visibly still. Only changed digits roll.

Default

LIVE
<talos-odometer value="1284903" group label="requests" unit="req"></talos-odometer>

The demo adds a few dozen to value every second. group inserts thousands separators; they are presentation only, so the digits read true in any frame.

Zero-padded digits

PREVIEW
<talos-odometer value="4821" digits="8" label="uptime s"></talos-odometer>

digits is a minimum digit count; shorter numbers are zero-padded so the columns do not shift as the total grows.

Distinct from its siblings

  • <talos-stat> counts once to a target: a magnitude transition.
  • <talos-readout> scrambles to mark the arrival of new telemetry.
  • <talos-odometer> rolls per digit, on every change: the cadence of the roll is the cadence of the data.

Behaviour

A running total has no health band, so there is no warn / crit. Under prefers-reduced-motion digits snap to the new value with no roll. The roll is a CSS transform transition per changed digit; there is no rAF loop.

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 total; missing or non-numeric reads "—" (no data)
digits number 0 minimum digit count, zero-padded; else natural.
group boolean — if present, insert thousands separators.
label string — caption above the counter.
unit string — suffix after the number.
duration number 400 roll duration in ms.
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

Properties and methods

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

CSS parts

::part(caption), ::part(readout), ::part(unit)