Skip to content
  • System
  • Light
  • Dark
  • High contrast

Gauge

Different sizes, colours, and format functions.

72Assessed
3.5Score
import { Gauge } from '@eekodigital/raster';

<Gauge value={72} max={86} title="Assessed" />
<Gauge value={3.5} max={4} title="Score" formatValue={(v) => v.toFixed(1)} color="var(--demo-good)" />
<Gauge value={45} max={100} title="Complete" formatValue={(v) => `${v}%`} size={80} thickness={8} />
  • role="meter" with aria-valuemin, aria-valuemax, aria-valuenow and aria-valuetext from format.
  • Named by the visible title through aria-labelledby, so what you see is what is announced.
  • The fill transition stops under prefers-reduced-motion.

See the Accessibility guide for the shared structure, the labels prop and screen-reader testing.

PropTypeDescription
valuenumberRequired.
minnumber

Default: 0

Start of the range.
maxnumberRequired. End of the range.
titlestringRequired. Visible title and accessible name.
labelsChartLabelOverrides

locale for the default number format, as on the other charts.

formatValue(value: number) => string

Default: Intl.NumberFormat

Formats the displayed value and aria-valuetext. Defaults to the number format for labels.locale.

sizenumberFixed diameter in px. Omit to fill the container’s width (square).
thicknessnumber

Default: 10

Ring thickness in px.
colorstring

Default: series 1

Fill colour.
trackColorstring

Default: grid colour

Track colour.
refRef<HTMLDivElement>

The chart’s root element, e.g. for exportSVG and exportPNG from @eekodigital/raster/export. See Exporting charts.

classNamestring