Skip to content

Gauge

ChartsSince 0.4.0

A radial gauge for one value within a known range, drawn on a 240 deg arc: a track, the value arc, optional qualitative bands (for example poor / fair / good) outside the track, an optional target marker, and the formatted value in the center with the current band’s name under it. The SVG is role="meter" with aria-valuenow, aria-valuemin, aria-valuemax, and a value text that names the band and the target, so the meaning never depends on color. It is a static reading: not focusable, no tooltip. Like Sparkline it does not use the chart frame, so it stays small. No animation.

  • Value in rangeA radial arc for one value between a minimum and maximum.
  • Bands and targetNamed qualitative bands and a target marker; the current band shows under the value.
  • Meter semanticsExposed as a meter whose value text names the band and the target.
  • LightweightA static reading without the chart frame, so it stays small.

Use it for

  • One key value against a known range (utilization, score, completion) on dashboards and cards.
  • When qualitative bands or a target give the value its meaning.

Use something else for

  • Comparing several values: use Bar Chart or Bullet Chart (lengths compare more accurately than angles).
  • Progress of a task: use Progress Bar.
  • Values without a meaningful range.
Anatomy
<div class="aui-gauge aui-gauge--c2">
<div class="aui-gauge__title" id="T">CPU</div>
<svg class="aui-gauge__svg" role="meter" aria-labelledby="T" aria-valuemin="0" aria-valuemax="100" aria-valuenow="72"
aria-valuetext="72% (0% to 100%), Busy, target 60%" viewBox="0 0 200 150">
<path class="aui-gauge__track" aria-hidden="true"/>
<path class="aui-gauge__band aui-gauge__band--c1" aria-hidden="true"/>...
<path class="aui-gauge__value" aria-hidden="true"/>
<path class="aui-gauge__target" aria-hidden="true"/>
<text class="aui-gauge__reading" aria-hidden="true">72%</text>
<text class="aui-gauge__band-label" aria-hidden="true">Busy</text>
<text class="aui-gauge__range" aria-hidden="true">0%</text> <text class="aui-gauge__range" aria-hidden="true">100%</text>
</svg>
<p class="aui-gauge__description" hidden></p>
</div>

Use the bar above each frame to switch theme, density, direction, and locale.

The part of the Quarter targets showcase that uses Gauge. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.

Showcase source
// KPI charts showcase: targets for a quarter with a gauge, bullet charts, a radar comparison
// (per-series style), a treemap with drill-down, and a recruitment funnel with conversion
// rates. Style and animation are switchable; point clicks are logged.
import { BulletChart } from '@absoluteui/components/bullet-chart';
import { FunnelChart } from '@absoluteui/components/funnel-chart';
import { Gauge } from '@absoluteui/components/gauge';
import { RadarChart } from '@absoluteui/components/radar-chart';
import { Treemap } from '@absoluteui/components/treemap';
import { chartControls, chartLook, createShowcase, hostIn, section, toggle } from './kit.js';
import { NumberInput } from '@absoluteui/components/number-input';
const sc = createShowcase({
title: 'Quarter targets',
description: 'Change the gauge value, drill into the treemap with Enter, and compare teams on the radar.',
});
const grid = hostIn(sc.stage);
grid.className = 'sc-grid';
const gaugeSection = section(sc, 'Customer satisfaction', ['gauge']);
const bulletSection = section(sc, 'Revenue against target', ['bullet-chart']);
grid.append(gaugeSection, bulletSection);
const gauge = Gauge.create(hostIn(gaugeSection), {
label: 'Customer satisfaction',
value: 78,
min: 0,
max: 100,
target: 85,
bands: [
{ to: 60, label: 'Poor', color: 2 },
{ to: 80, label: 'Fair', color: 4 },
{ to: 100, label: 'Good', color: 3 },
],
});
const bullet = BulletChart.create(hostIn(bulletSection), {
label: 'Revenue against target',
measures: [
{ id: 'emea', label: 'EMEA', value: 410, target: 450, ranges: [300, 400, 500] },
{ id: 'apac', label: 'APAC', value: 380, target: 350, ranges: [250, 350, 450] },
{ id: 'amer', label: 'Americas', value: 520, target: 560, ranges: [400, 500, 600] },
],
valueFormat: { style: 'currency', currency: 'EUR', notation: 'compact' },
height: 220,
});
const valueInput = NumberInput.create(hostIn(gaugeSection), { label: 'Satisfaction score', value: 78, min: 0, max: 100, step: 1 });
valueInput.host.addEventListener('aui-change', (e) => {
const v = (e as CustomEvent<{ value: number | null }>).detail.value;
gauge.update({ value: v });
sc.log('gauge value', v);
});
const compare = hostIn(sc.stage);
compare.className = 'sc-grid';
const radarSection = section(sc, 'Team skills', ['radar-chart']);
const treeSection = section(sc, 'Spending by department', ['treemap']);
compare.append(radarSection, treeSection);
const radar = RadarChart.create(hostIn(radarSection), {
label: 'Team skills',
axes: ['Delivery', 'Quality', 'Collaboration', 'Innovation', 'Customer focus'],
series: [
{ id: 'platform', label: 'Platform', values: [8, 9, 7, 6, 7] },
{ id: 'web', label: 'Web', values: [9, 7, 8, 8, 9], style: { dash: 'dashed', marker: 'diamond' } },
],
valueAxis: { min: 0, max: 10 },
fill: true,
height: 300,
});
const tree = Treemap.create(hostIn(treeSection), {
label: 'Spending by department',
drillDown: true,
rootLabel: 'All departments',
data: [
{ id: 'eng', label: 'Engineering', children: [{ id: 'cloud', label: 'Cloud', value: 420 }, { id: 'tools', label: 'Tools', value: 120 }, { id: 'hw', label: 'Hardware', value: 90 }] },
{ id: 'sales', label: 'Sales', children: [{ id: 'events', label: 'Events', value: 160 }, { id: 'travel', label: 'Travel', value: 110 }] },
{ id: 'ops', label: 'Operations', children: [{ id: 'rent', label: 'Rent', value: 300 }, { id: 'utilities', label: 'Utilities', value: 60 }] },
],
valueFormat: { style: 'currency', currency: 'EUR', notation: 'compact' },
height: 300,
});
const funnel = FunnelChart.create(hostIn(section(sc, 'Recruitment funnel', ['funnel-chart'])), {
label: 'Recruitment funnel',
stages: [
{ id: 'applied', label: 'Applied', value: 1240 },
{ id: 'screened', label: 'Screened', value: 610 },
{ id: 'interviewed', label: 'Interviewed', value: 220 },
{ id: 'offer', label: 'Offer', value: 48 },
{ id: 'hired', label: 'Hired', value: 37 },
],
showConversion: true,
height: 280,
});
sc.listen(tree.host, ['aui-drill', 'aui-series-toggle', 'aui-point-click'], 'treemap');
sc.listen(radar.host, ['aui-series-toggle', 'aui-point-click'], 'radar');
sc.listen(bullet.host, ['aui-point-click'], 'bullet');
sc.listen(funnel.host, ['aui-point-click'], 'funnel');
chartControls(sc, [bullet, radar, tree, funnel], ['bullet-chart', 'radar-chart', 'treemap', 'funnel-chart']);
chartLook(sc, [gauge, bullet, radar, tree, funnel]);
toggle(sc, 'Radar fill', true, (fill) => {
radar.update({ fill });
}, ['radar-chart']);
toggle(sc, 'Funnel conversion', true, (showConversion) => {
funnel.update({ showConversion });
}, ['funnel-chart']);
toggle(sc, 'Treemap labels', true, (tileLabels) => {
tree.update({ tileLabels });
}, ['treemap']);

Gauge with bands, a target, and percent values

Section titled “Gauge with bands, a target, and percent values”
import { Gauge } from '@absoluteui/components/gauge';
const host = document.createElement('div');
document.body.append(host);
const gauge = Gauge.create(host, {
label: 'CPU load',
value: 72,
bands: [
{ to: 50, label: 'Normal', color: 3 },
{ to: 80, label: 'Busy', color: 5 },
{ to: 100, label: 'Critical', color: 2 },
],
target: 60,
valueFormat: { style: 'unit', unit: 'percent' },
});
host.dataset.reading = gauge.valueText;

Custom range and a value updated over time

Section titled “Custom range and a value updated over time”
import { Gauge } from '@absoluteui/components/gauge';
const host = document.querySelector<HTMLElement>('#nps');
if (host) {
const gauge = Gauge.create(host, { label: 'Net promoter score', value: null, min: -100, max: 100, showRange: true, description: 'Last 30 days' });
gauge.update({ value: 38 });
}
Terminal window
npm install @absoluteui/components @absoluteui/core @absoluteui/theme

Registry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.

import { Gauge } from '@absoluteui/components/gauge';
import '@absoluteui/components/gauge/style.css';
import { Gauge } from '@absoluteui/components/gauge';
import '@absoluteui/components/gauge/style.css';
const host = document.querySelector<HTMLElement>('#score');
if (host) {
const gauge = Gauge.create(host, { label: 'Quality score', value: null, bands: [{ to: 40, label: 'Poor' }, { to: 70, label: 'Fair' }, { to: 100, label: 'Good' }] });
gauge.update({ value: 64 });
}
More usage
import { Gauge } from '@absoluteui/components/gauge';
const host = document.createElement('div');
document.body.append(host);
Gauge.create(host, {
label: 'CPU',
value: 72,
bands: [{ to: 50, label: 'Low' }, { to: 80, label: 'Busy' }, { to: 100, label: 'Critical' }],
target: 60,
valueFormat: { style: 'unit', unit: 'percent' },
});

Using Angular? See Gauge for Angular.

Gauge.create(host: HTMLElement, options: GaugeOptions): Gauge

Global configuration key: gauge (see Configuration).

Option Type Default Description
label string What is measured: visible title and the accessible name of the meter (aria-labelledby). Required.
hideLabel boolean false Visually hide the title; it stays the accessible name.
description string Visible text below the gauge (text only). Not referenced by aria-describedby.
value number | null Current value. null (or a non-finite number) shows an em dash and the value text “No value”; aria-valuenow is removed. Values outside min-max are clamped on the arc and in aria-valuenow; the value text keeps the real value. Required.
min number 0 Range start (finite).
max number 100 Range end (finite, greater than min).
bands readonly GaugeBand[] Qualitative bands { to: number, label: string, color?: 1-8 } in ascending to order; the first band starts at min. Drawn as a thin arc outside the track; the current band’s label is printed under the reading and appended to the value text.
target number Target value marked across the arc; appended to the value text (“target 60%”).
color 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 Palette slot of the value arc. Default: the current band’s color (its color, else its position), else 1.
valueFormat Intl.NumberFormatOptions Number format for the reading, range ends, target, and value text.
formatValue (value: number) => string Custom value text; overrides valueFormat everywhere.
valueText string Replaces the generated aria-valuetext.
theme ChartTheme Look and feel: { palette?: string[] (1-8 CSS colors for slots 1-8); fontFamily?; fontSize? (8-32 px); textColor?; gridLines?: boolean; gridColor?; gridDash? (“4 2” or “none”); axisColor?; lineWidth? (0.5-12 px); markerSize? (1-20 px); cornerRadius?, barRadius?, cellRadius?, sliceRadius?, boxRadius? (0-50 px); swatchRadius? (0-8 px); tooltipRadius?, controlRadius? (0-50 px); lineJoin?: ‘round’ | ‘miter’ | ‘bevel’; areaOpacity? (0-1); gradient?: boolean; valueLabelColor?; tooltip?: { background?, color?, borderColor? }; legendPosition?: ‘top’ | ‘bottom’ | ‘start’ | ‘end’; animation?: boolean | { duration?: number (0-5000 ms) } }. Applied as –aui-chart-* custom properties and classes on the host through the CSSOM (CSP-safe); colors are validated with CSS.supports(‘color’). Animation is opt-in and never runs with prefers-reduced-motion: reduce or [data-aui-animation=‘none’]. The gauge uses palette, gridColor (track), fontFamily, textColor (range and band labels), and animation.
showRange boolean true Print the formatted min and max under the ends of the arc. Globally configurable.
locale string "en-US" Number and message locale. Globally configurable. Inherited from common configuration.
direction 'ltr' | 'rtl' "ltr" Accepted for configuration consistency; the gauge is not mirrored (min at the lower left, clockwise to max at the lower right). Globally configurable. Inherited from common configuration.
Property Type Description
host HTMLElement The host element.
element SVGSVGElement The svg role=“meter”.
valueText string The accessible value text (aria-valuetext: generated or valueText).
Method Description
update(options: Partial<GaugeOptions>): void Merge, validate, and re-render.
destroy(): void Remove rendering, host classes, and the configuration subscription.

All rules live in the aui.components cascade layer, so application styles override them without specificity battles.

Class Purpose
aui-gauge Host; inline grid, 12rem wide by default (set inline-size to resize; the SVG scales through its viewBox).
aui-gauge--c1 ... --c8 Value arc palette slot; sets –aui-gauge-color.
aui-gauge__title / __title--hidden / __description Title (accessible name) and description.
aui-gauge__svg The svg role=“meter”.
aui-gauge__track / __value Background arc and value arc (aria-hidden).
aui-gauge__band / __band--c1 ... --c8 Band arcs and their palette slots (aria-hidden).
aui-gauge__target Target marker line (aria-hidden).
aui-gauge__reading / __band-label / __range Center reading, current band name, and range ends (aria-hidden).

Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.

--aui-color-chart-1 | --aui-color-chart-2 | --aui-color-chart-3 | --aui-color-chart-4 | --aui-color-chart-5 | --aui-color-chart-6 | --aui-color-chart-7 | --aui-color-chart-8 | --aui-color-chart-grid | --aui-color-text | --aui-color-text-muted | --aui-easing-standard | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-semibold | --aui-line-height-tight | --aui-space-1

TypeScript definitions
type GaugeColor = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
interface GaugeConfig { showRange: boolean }
interface GaugeBand { to: number; label: string; color?: GaugeColor }
interface GaugeOptions extends Partial<GaugeConfig> {
label: string;
hideLabel?: boolean;
description?: string;
value: number | null;
min?: number;
max?: number;
bands?: readonly GaugeBand[];
target?: number;
color?: GaugeColor;
valueFormat?: Intl.NumberFormatOptions;
formatValue?: (value: number) => string;
valueText?: string;
locale?: string;
direction?: 'ltr' | 'rtl';
}

Pattern: Static meter: svg role=“meter” (WAI-ARIA 1.2) named by the title, with aria-valuenow/min/max and an aria-valuetext that names the band and the target.

Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.

Key Context Action
None Any Not focusable (a static reading); screen readers reach the meter in browse mode.
Element Role
svg.aui-gauge__svg meter
arcs, target marker, reading, band name, range ends aria-hidden (the value text carries the meaning)
Attribute Element Value
aria-labelledby svg id of the visible (or visually hidden) title
aria-valuemin / aria-valuemax svg min and max (defaults 0 and 100)
aria-valuenow svg The value clamped to min-max; removed when the value is null
aria-valuetext svg Localized “{value} ({min} to {max}), {band}, target {target}”, for example “72% (0% to 100%), Busy, target 60%”; “No value” (plus the target) when the value is null; or valueText

Not focusable.

Criterion Level Note
1.1.1 Non-text Content A
1.3.1 Info and Relationships A
1.4.1 Use of Color A
1.4.3 Contrast (Minimum) AA
1.4.11 Non-text Contrast AA
4.1.2 Name, Role, Value A

Automated test results: Accessibility and compliance.

  • Meaning never depends on color: the value is printed in the center, the current band’s name is printed under it and included in the value text, and the target is named in the value text.
  • The value arc (color-chart-<slot>) meets 3:1 against surfaces; the track (color-chart-grid) only frames it.
  • Forced colors: the value arc uses Highlight, the track GrayText, bands, target, and text CanvasText.
  • No animation.
  • role=“meter” is ARIA 1.2 and support varies across screen readers and browsers.
  • The description is visible text only; it is not referenced by aria-describedby.
  • Manual screen-reader verification is pending.
Import cost Minified gzip brotli CSS brotli
@absoluteui/components/gauge 19.3 kB 7.4 kB 6.6 kB 0.9 kB

Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.

Budget (enforced in CI) Limit
Gauge.create with bands and a target, per instance < 2 ms in headless Chromium (e2e performance test)

Tested scale: Dozens of instances per page; no layout reads and no resize observer.

Budget: Gauge.create < 2 ms per instance in headless Chromium (e2e performance test). No layout reads and no resize observer.

Measured run times: Performance.

States

default, with bands (current band named), with target, no value (null: “-”, “No value”, no aria-valuenow), value out of range (clamped on the arc and in aria-valuenow).

State transitions
From Trigger To
any update({ value }) re-rendered; new aria-valuenow and value text
value update({ value: null }) no value
any configuration change (showRange, locale) re-rendered
Accessibility notes
  • Meaning never depends on color: the reading is printed, the band name is printed and in the value text, and the target is named in the value text.
  • Not focusable by design (a static reading, like Progress Bar); put interactive detail elsewhere.
  • The value arc meets 3:1 against surfaces; the track only frames it.
  • Forced colors: value arc Highlight, track GrayText, bands, target, and text CanvasText.
  • role="meter" is ARIA 1.2; support varies. No animation. Manual screen-reader verification is pending.
Responsive behavior

Scales with its inline size through the viewBox (200 x 150 units); text scales with it.

Right-to-left

Not mirrored: min is always at the lower left and the arc runs clockwise to max at the lower right. direction is accepted for configuration consistency. Title and description follow the document direction.

Theming

Value arc color-chart-<slot>; bands color-chart-<n>; track color-chart-grid; target and reading color-text; band name and range color-text-muted.

Global configuration
configureAbsoluteUI({ components: { gauge: { showRange: false } } });
Component configuration

Instance options override global and theme defaults. All options are dynamic.

Security

Text uses textContent and attribute values; SVG uses createElementNS; colors are classes. No innerHTML or style attributes.

Data handling

No persistence, network access, or telemetry.

Supported data scale

One value per instance; dozens of instances per page.

Edge cases
  • null or non-finite values: “-” in the center, “No value”, no value arc, no band.
  • Values below min or above max: clamped on the arc and in aria-valuenow; the reading and value text keep the real value; the first / last band applies.
  • A value equal to min draws no value arc.
  • Bands need not reach max; values above the last band’s to (but within the range) name no band.
Errors
Code Category Cause
GAUGE_OPTIONS configuration Missing label; value not a number or null; non-finite min; max <= min; bands without labels or not in ascending to order above min; invalid colors, target, text options, or formatters.
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION configuration Invalid or unknown configuration.

A failed construction leaves the host untouched.

Known limitations
  • Fixed 240 deg arc; no needle or intermediate ticks.
  • Not interactive; not mirrored in RTL.
  • Manual screen-reader verification is pending.
  • theme applies only the properties listed in section 5; tooltips, legends, annotations, point events, and synchronized crosshairs do not apply (static images).
Unsupported scenarios
  • Several values or needles; semicircle, full-circle, or linear variants.
  • Editing the value.