Gauge
A 270-degree ring meter for one value against a bounded range, with optional threshold states.
import { Gauge } from '@uthereal/ui/gauge'Gauge playground
Overview
A gauge displays a single measure against a known range (such as storage against a quota or a score out of 100) as a 270-degree ring with the formatted reading centered inside. With thresholds, the highest reached band sets the arc tone and displays a named state label beneath the reading so status never relies on color alone.
Use a gauge for a single headline measurement with meaningful lower and upper bounds. For task or step completion, use Progress bar. For changes over time, use a line chart. To compare multiple categories, use a bar chart.
Usage
import { Gauge } from '@uthereal/ui/gauge'
export function Storage({ used }: { used: number }) {
return (
<Gauge
label="Storage used"
description={`${used} of 60 GB`}
value={used}
max={60}
thresholds={[
{ from: 0, tone: 'success', label: 'Healthy' },
{ from: 45, tone: 'warning', label: 'Near limit' },
]}
/>
)
}Values outside [min, max] are clamped to the range. max must exceed min, and thresholds (up to six bands) must appear in strictly ascending order of from.
Examples
Threshold bands
The highest threshold whose from value is reached sets both the ring tone and the visible state label.
Percent vs formatted value
display: 'percent' (default) renders the share of the range with a half-size secondary percent sign. display: 'value' renders the raw value formatted with valueFormat (such as currency).
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
label | stringDefault: "Storage used" | What is measured, in sentence case. It names the meter for assistive technology. |
description | string— | Supporting text below the label, such as "42 of 60 GB"; it describes the meter. |
value | numberDefault: 0 | Current value, between min and max. Values outside the range are clamped. |
min | numberDefault: 0 | Value at the start of the ring. |
max | numberDefault: 100 | Value at the end of the ring. Must be greater than min. |
thresholds | GaugeThreshold[]Default: [] | Bands in ascending order of from, each with a tone and a label. The highest band the value reaches colors the ring and names the state under the number and in the value text. |
display | percent | valueDefault: "percent" | percent shows the share of the range (72%); value shows the value itself, formatted with valueFormat. |
valueFormat | NumberFormat— | How the value appears when display is value: decimal, percent or currency, with fraction digits. |
locale | string— | BCP 47 locale for numbers. Omit it to inherit the application locale (en-US by default). |
tone | neutral | accent | success | warning | dangerDefault: "accent" | Ring color without thresholds. accent follows the theme accent; success, warning and danger report an outcome the label or a threshold states. |
size | sm | md | lgDefault: "md" | Ring width of 128, 176 (Arc) or 224 pixels; the ring shrinks to fit a narrower container. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | GaugeTheme— | Color mode, accent, and tokens, including size and valueSize in pixels. See Theming. |
motion | none | subtle | expressiveDefault: "subtle" | Animation preset: the ring fills on a slow spring once half of it is in view while the number counts up, later values spring there and the state and label roll. System reduced-motion preferences take precedence. |
motionOptions | GaugeMotionOptions— | transition replaces the springs used for later values (after the first fill): a tween with a duration (ms) or a spring. |
dir | ltr | rtl— | Reading direction. Omit it to inherit the page direction. |
React integration
| Prop | Purpose |
|---|---|
preset | Application defaults, overridden by explicit instance props |
tokens | CSS variables applied after the typed theme |
ref | Ref forwarded to the root <figure> |
className, style | Applied to the root <figure> |
| Native attributes | id, data-*, and remaining <figure> attributes forwarded to the root |
Keyboard & accessibility
Gauge is a non-focusable display meter; it has no keyboard shortcuts or separate data table because its accessible value text conveys the full reading.
The component renders a <figure> named by its label, value against range, and active threshold state (for example, "Workspace health: 72 of 100, Healthy"), with label and description inside <figcaption>. The ring carries role="meter" with aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext (combining the formatted reading and state label). The visual numeric readout is aria-hidden to avoid duplicate announcements. The unfilled track renders as a 13% tint of the active arc color, and threshold states pair color with explicit text. Under forced-colors, system colors apply.
Motion and theming
When half the ring enters the viewport, the arc fills on a critically damped spring while the readout counts up inside a fixed-width box sized to the final value; server-rendered markup shows the final state. Subsequent value updates spring on the morph spring, transitioning tone and state text as the count crosses each threshold and rolling label, state, and description in the direction of change. motionOptions.transition overrides the update transition with a tween (duration in ms) or a spring. prefers-reduced-motion: reduce places the ring immediately and crossfades text; motion="none" updates everything immediately.
theme accepts a mode, an accent, and semantic tokens for text, status tones, size (128, 176, or 224 px), and valueSize. An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, Gauge is a leaf with no actions. The host updates value through composition updates. See Building with agents.
{
"type": "Gauge",
"props": { "label": "Storage used", "value": 42, "max": 60 },
"children": []
}