Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Gauge chart

A notched arc or a continuous ring, one number in the middle.

Installation

pnpm add @heyramzi/ui

Usage

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

value required number
Arc fill, 0-100 (how many notches light up).
variant "gauge" | "ring"
Default "gauge"
"gauge" = notched arc, "ring" = continuous swept arc.
showValue boolean
Default true
Show the center value/label. Off when the number sits beside the gauge.
color string
Active arc color (CSS color or var). Alias for `activeFill`.
gradient boolean
Single-hue gradient along the active arc. Alias for `useGradient`.
label string
Center label under the value. Alias for `defaultLabel`.
centerValue number
Center statistic. Defaults to `value`. Formatted via `formatOptions`.
totalNotches number
Default 40
Notch count around the arc.
spacing number
Default 25
Gap between notches as a percentage of the arc.
notchLengthPercent number
Default 100
Radial depth of the notch band as a percentage of the default.
notchCornerRadius number
Corner fillet in viewBox units (0 = sharp). Defaults to a soft pill.
uniformWidth boolean
Default false
Rectangular notches instead of angular/tapered.
startAngle number
Default 135
Arc start in degrees (default 135, sweeping to 405 = 270deg with a bottom gap).
endAngle number
Default 405
useGradient boolean
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`.
activeFill string
Default "var(--chart-series-1)"
Active notch color (CSS color or var).
inactiveFill string
Track notch color. Defaults to `activeFill`.
activeFillOpacity number
Default 1
inactiveFillOpacity number
Default 0.12
defaultLabel string
Default "Total"
Center label under the value.
formatOptions Intl.NumberFormatOptions
Intl formatting for the center value.
locale string
prefix string
suffix string
size number
Fixed square size in px. Omit to fill the parent (responsive).
minWidth number
Default 160
Minimum width when responsive.
ariaLabel string
Accessible description, e.g. "ARR run rate".
class string
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