One value within a range as a half ring — a score, a quota or a target. A meter for assistive technology.
$ pnpm dlx shadcn@latest add https://dashral.com/r/gauge.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/gauge.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
components.json
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/gaugeUsage
example.tsx
import { Gauge } from "@/components/dashral/gauge"
<Gauge value={0.72} max={1} label="Storage used" formatOptions={{ style: "percent" }} />Examples
API reference
Gauge
Also takes every prop of <div>(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
value | numberRequired. | — |
min / max | numberThe range. | 0 / 100 |
label | stringUnder the number; also the accessible name. | — |
formatOptions / locale | Intl.NumberFormatOptions / stringe.g. { style: "percent" } with max={1}. | LocaleProvider's |
levels | { from: number; className: string }[]Colors by level, lowest first. | — |
size / thickness | numberWidth and arc width in pixels. | 180 / 14 |
Accessibility
- role="meter" with aria-valuenow, min, max and the formatted value as aria-valuetext.
Motion
- The arc fills from empty when it first shows; instant with reduced motion.