Gauge chart
A notched arc or a continuous ring, one number in the middle.
Installation
pnpm add @heyramzi/uiUsage
import { GaugeChart } from "@heyramzi/ui/charts";<div class="size-44">
<GaugeChart value={72} label="Health" />
</div>Keyboard and accessibility
- The gauge is an image named by its value, like "Gauge at 72%". Pass ariaLabel to say what it measures.
- With reduced motion on, the arc shows without filling in.
API reference
valuerequirednumber- Arc fill, 0-100 (how many notches light up).
variant"gauge" | "ring"- Default
"gauge" - "gauge" = notched arc, "ring" = continuous swept arc.
showValueboolean- Default
true - Show the center value/label. Off when the number sits beside the gauge.
colorstring- Active arc color (CSS color or var). Alias for `activeFill`.
gradientboolean- Single-hue gradient along the active arc. Alias for `useGradient`.
labelstring- Center label under the value. Alias for `defaultLabel`.
centerValuenumber- Center statistic. Defaults to `value`. Formatted via `formatOptions`.
totalNotchesnumber- Default
40 - Notch count around the arc.
spacingnumber- Default
25 - Gap between notches as a percentage of the arc.
notchLengthPercentnumber- Default
100 - Radial depth of the notch band as a percentage of the default.
notchCornerRadiusnumber- Corner fillet in viewBox units (0 = sharp). Defaults to a soft pill.
uniformWidthboolean- Default
false - Rectangular notches instead of angular/tapered.
startAnglenumber- Default
135 - Arc start in degrees (default 135, sweeping to 405 = 270deg with a bottom gap).
endAnglenumber- Default
405 useGradientboolean- Default
false - Single-hue gradient along the active arc instead of a flat fill.
activeGradient[string, string]- Hex stops for the active gradient. Defaults to a tonal ramp of `activeFill`.
activeFillstring- Default
"var(--chart-series-1)" - Active notch color (CSS color or var).
inactiveFillstring- Track notch color. Defaults to `activeFill`.
activeFillOpacitynumber- Default
1 inactiveFillOpacitynumber- Default
0.12 defaultLabelstring- Default
"Total" - Center label under the value.
formatOptionsIntl.NumberFormatOptions- Intl formatting for the center value.
localestringprefixstringsuffixstringsizenumber- Fixed square size in px. Omit to fill the parent (responsive).
minWidthnumber- Default
160 - Minimum width when responsive.
ariaLabelstring- Accessible description, e.g. "ARR run rate".
classstring
| Prop | Type | Default |
|---|---|---|
value required Arc fill, 0-100 (how many notches light up). | number | |
variant "gauge" = notched arc, "ring" = continuous swept arc. | "gauge" | "ring" | "gauge" |
showValue Show the center value/label. Off when the number sits beside the gauge. | boolean | true |
color Active arc color (CSS color or var). Alias for `activeFill`. | string | |
gradient Single-hue gradient along the active arc. Alias for `useGradient`. | boolean | |
label Center label under the value. Alias for `defaultLabel`. | string | |
centerValue Center statistic. Defaults to `value`. Formatted via `formatOptions`. | number | |
totalNotches Notch count around the arc. | number | 40 |
spacing Gap between notches as a percentage of the arc. | number | 25 |
notchLengthPercent Radial depth of the notch band as a percentage of the default. | number | 100 |
notchCornerRadius Corner fillet in viewBox units (0 = sharp). Defaults to a soft pill. | number | |
uniformWidth Rectangular notches instead of angular/tapered. | boolean | false |
startAngle Arc start in degrees (default 135, sweeping to 405 = 270deg with a bottom gap). | number | 135 |
endAngle | number | 405 |
useGradient Single-hue gradient along the active arc instead of a flat fill. | boolean | false |
activeGradient Hex stops for the active gradient. Defaults to a tonal ramp of `activeFill`. | [string, string] | |
activeFill Active notch color (CSS color or var). | string | "var(--chart-series-1)" |
inactiveFill Track notch color. Defaults to `activeFill`. | string | |
activeFillOpacity | number | 1 |
inactiveFillOpacity | number | 0.12 |
defaultLabel Center label under the value. | string | "Total" |
formatOptions Intl formatting for the center value. | Intl.NumberFormatOptions | |
locale | string | |
prefix | string | |
suffix | string | |
size Fixed square size in px. Omit to fill the parent (responsive). | number | |
minWidth Minimum width when responsive. | number | 160 |
ariaLabel Accessible description, e.g. "ARR run rate". | string | |
class | string |