shadcn Gauge Chart: When a Gauge Is the Right Call, and a Free One
The shadcn/ui charts don't include a gauge. The usual workaround is a radial chart with half the circle hidden, which gets you the shape but not the parts that make a gauge useful: a target, a clear "how far off are we" line, and colours that know whether higher is good. This guide covers when a gauge is worth its space, what to check in any gauge component, and how to install a free one in a shadcn project.
When to use a gauge (and when not to)
Gauges have a bad reputation in data visualization, mostly earned: dashboards full of speedometers spend a big circle on each number and show no trend. But a gauge is the right call when the limit itself matters:
- Quota attained: 82% of Q4 quota, with the target tick at 90%.
- Budget used: $1.9M of a $3M annual budget, where going over is the thing to avoid.
- Capacity in use: seats, storage, API calls against a plan limit.
Use something else when:
- There's no natural maximum (revenue, sign-ups): use a KPI tile with a sparkline.
- You need the trend, not just today's value: put a line chart next to it, or use a KPI tile.
- You have several numbers against targets: a bullet chart packs each into one row, and a radial bar chart shows a few progress rings together.
The checklist
- A real scale. Min and max are part of the data (0 to the budget, 0 to 100%), not decoration.
- A target tick, and words under the number saying how far above or below target you are.
- Colour by meaning, not by sign. Spending below budget is good; bookings below quota is not. The component needs to know which direction is favourable.
- Values off the scale are handled. 112% of budget should be drawn at the end of the arc with a note, not overflow or wrap around.
- The number is text, large enough to read without the arc, and available to screen readers.
Install the free gauge
ChartslibraryUI's gauge chart is free (MIT). Install it with the shadcn CLI:
pnpm dlx shadcn@latest add @chartslibraryui/gauge-chartnpx shadcn@latest add @chartslibraryui/gauge-chartyarn dlx shadcn@latest add @chartslibraryui/gauge-chartbunx --bun shadcn@latest add @chartslibraryui/gauge-chartor by URL: npx shadcn@latest add https://chartslibraryui.com/r/gauge-chart.json.
It takes props rather than rows. Percent formats default to a 0 to 100% scale:
<GaugeChart
title="Q4 quota is 82% closed with three weeks to go"
value={0.82}
target={0.9}
format="percent"
caption="of Q4 quota"
/>For a budget, set max and say that lower is better with favorable="down":
<GaugeChart
title="Cloud spend has used 64% of the annual budget"
value={1_920_000}
max={3_000_000}
target={2_250_000}
format="currency-compact"
favorable="down"
caption="of the $3M annual budget"
/>A value outside the scale is drawn at the end of the arc with a note, and max at or below min shows an error instead of a broken arc.
Keep gauges in their place
- One or two per dashboard, for the limits that matter most.
- Title with the finding: "Q4 quota is 82% closed with three weeks to go", not "Quota".
- Pair it with the trend so readers can tell a good week from a good quarter.
Related
- Bullet chart guide: several measures against targets
- Radial bar chart: progress toward a few goals at once
- KPI tile: one number with its change and trend