Gauge Chart
Gauge for one value on its scale: semi-circle, speedometer, ring or segmented. The arc draws to the value and the number counts up.
Playground
Installation
Gauge Chart comes with WunderUI Core and Pro, in the package from your plan. See the plans.
The charts live in their own entry point: import the chart, its card and its hooks from @wunderui/react/charts, not from @wunderui/react.
Then import what you need:
import {
GaugeChart,
GaugeChartProps,
GaugeChartVariant,
} from "@wunderui/react/charts"Then use it:
import { GaugeChart } from "@wunderui/react/charts"
export function CpuLoad() {
return <GaugeChart value={68} caption="of 4.0 GHz" label="CPU load" />
}Expected result: You see a half dial filled to 68 percent, with the number and caption under the arc.
When to use
Use Gauge Chart for
- One value against its scale: load, memory, a score
- A value that falls into bands (normal, high, critical)
- A dial on a dashboard tile
Use something else for
- Radial Chart for several values as rings
- Progress Chart for quotas as meters
- Bullet Chart for a value against a target and ranges
- Sparkline for the history of a value
States
Loading, empty and error keep the chart's size, so the card never jumps. Add a retry handler and the error state offers a Try again button.
Needle and ticks
A needle and a scale of ticks can be added around the arc. When the value changes, the needle swings to it with a spring, the number counts to the new value and the colour follows.
Keyboard interactions
The gauge shows one value, so the plot has one stop and the live region reads that value on its scale.
- TaborShiftTab
- Moves focus to the gauge and away from it.
- ArrowRightorArrowLeft
- Land on the single value; the live region reads the label and the value on its scale ("CPU load: 64%"), never a share of a total.
Behavior and motion
What the chart does on its own and what the page decides.
- One value
- Set the value and, if needed, the scale (default 0 to 100). A label names the value and a caption adds a unit line; a value that isn't a finite number counts as empty.
- Colour bands
- The speedometer and segmented gauge colour the arc by band: green to 60 percent, yellow to 80, red above. Pass your own ranges, or one colour for the semi-circle and ring.
- Needle and ticks
- Needle and ticks shape the semi-circle and the speedometer. Min and max labels replace the texts at the ends of the scale.
- Loading, empty and error
- The chart keeps its size while loading, empty or failed, so the card never changes height. Add a retry handler to show a Try again button on error.
- Size
- The chart fills the width of its container, and you set the plot height. Text never scales: labels keep their size at every width.
Motion
The enter sequence and hover follow the library's motion tokens.
- Draw-in
- The arc draws to the value and the number counts up the first time the gauge is in view. A needle swings in from the start of the scale.
- New value
- When the value changes, the arc and number follow it and the needle re-aims with a spring.
- Reduced motion
- With reduced motion the enter sequence is off and the chart appears at once. Tooltip, crosshair and every state still work.
Anatomy
GaugeChart shows one value against its scale: a semi-circle, a speedometer with colour bands and a needle, a full ring or a segmented scale. The arc draws to the value on first view.
CPU load
| name | Value |
|---|---|
| CPU load | 68% |
Takes one value on a min to max scale. Options add a label, a unit caption, colour bands, a needle, ticks, segments and custom end texts.
- data-slot="chart-plot"
The focusable region. Arrow keys land on the single value and the live region reads its label and value on the scale, like CPU load: 64%.
- data-slot="chart-marks"
The track and the value arc, or the segments. On the speedometer the arc is split into colour bands, and a needle swings in from the start and re-aims with a spring when the value changes.
The number under the arc, which gets smaller with the gauge (20, 16 or 14 px), with the caption below and the min and max at the ends of the half arc.
By default green up to 60 percent of the scale, yellow to 80, red above (Normal, High, Critical). The speedometer and segmented gauge colour by band; the semi-circle and ring use one colour.
- data-slot="chart-tooltip"
The label and the value, with a dot in the band colour on the speedometer and segmented variants.
- data-slot="chart-message"
A muted half ring (a full ring on the ring gauge) under the shimmer. A value that isn't a finite number counts as empty and reads no value.
The value as a one-row table for screen readers.
Best practices
- Do
Show the number and unit as text, not only as an arc. The arc is a glance; a caption like of 4.0 GHz carries the meaning for everyone.
- Do
Add bands only where a threshold has a decision attached, such as normal, high and critical. Bands without an action are noise.
- Do
Pair the colour with the band label in the tooltip and caption. Green, yellow and red alone fail for people who can't tell them apart.
- Don’t
Don't use a speedometer for values that only need a percentage. A ring gauge or ProgressChart takes less space and has no needle to misread.
- Don’t
Don't leave min and max implicit when the scale isn't 0 to 100. The default formatter adds a percent sign, so pass a value formatter for any other unit.
API reference
One table for GaugeChart, listing every prop. The ChartCard around it takes its own props (title, legend, periods, table and more), and the chart works without one.
Takes one value on a min to max scale. Options add a label, a unit caption, colour bands, a needle, ticks, segments and custom end texts.
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("gauge-chart")The full library index for assistants is at /llms.txt.