Gauge
Examples
Section titled “Examples”Different sizes, colours, and format functions.
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} />Accessibility
Section titled “Accessibility”role="meter"witharia-valuemin,aria-valuemax,aria-valuenowandaria-valuetextfromformat.- Named by the visible
titlethrougharia-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.
| Prop | Type | Description |
|---|---|---|
value | number | Required. |
min | numberDefault: | Start of the range. |
max | number | Required. End of the range. |
title | string | Required. Visible title and accessible name. |
labels | ChartLabelOverrides |
|
formatValue | (value: number) => stringDefault: | Formats the displayed value and |
size | number | Fixed diameter in px. Omit to fill the container’s width (square). |
thickness | numberDefault: | Ring thickness in px. |
color | stringDefault: | Fill colour. |
trackColor | stringDefault: | Track colour. |
ref | Ref<HTMLDivElement> | The chart’s root element, e.g. for |
className | string |