Radial bar chart
Up to five progress arcs nested in one another, each from zero to its share of a maximum, with a total in the middle. Use it for a few goals of the same kind: quota by region, storage by disk. Lengths on an arc are harder to compare than on a bar, so when the exact comparison matters, use the bullet chart or the bar chart.
Install
npx shadcn@latest add @thrum-pro/radial-bar-chartThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Data shape
type RadialBarChartItem = {
name: string; // written at the ring's start
value: number | null; // null = empty track
};[
{ name: "North", value: 0.82 },
{ name: "South", value: 0.64 },
{ name: "East", value: null },
]Props
| Prop | Type | Default | Description |
|---|---|---|---|
data | readonly RadialBarChartItem[] | Required | The rings, outermost first. Up to five are drawn in the theme's chart colours; the rest are left out. |
label | string | Required | What the values measure. Shown under the total, read by screen readers and used as the table caption. |
max | number | Default largest value | The value of a full ring. A value past it draws a full ring and keeps its real number in the readout. |
sweep | number | Default 270 | How far a full ring goes round, in degrees, clockwise from 12 o'clock. Clamped to 90 to 360. Below 360 the names sit in the open quarter left of 12 o'clock. |
total | number | null | – | The figure in the centre while no ring is under the cursor, with the label under it. Leave it out for an empty centre. |
format | Intl.NumberFormatOptions | Default compact | How values are written in the centre, the readout and the data table. Shares of the maximum are whole percentages. |
locale | string | Default "en-US" | Locale for numbers. Fixed by default so the server and the browser print the same text. |
onActiveChange | (index: number | null) => void | – | Called with the index of the ring under the cursor, or null when the cursor leaves. |
sound | boolean | Default true | Play a tick as the cursor moves between rings, if the visitor has sound on. |
emptyLabel | string | Default "No data" | Text shown when there are no rings. |
className | string | – | Sets the size. The default is full width and 256 pixels tall; the rings fill the largest square that fits. Under 240 pixels wide the names move to a legend below the rings. |
Motion and sound
Motion
- First draw: each ring sweeps out clockwise from 12 o'clock in 250 ms, outermost first, 40 ms apart.
- New data: every ring slides to its new length in 400 ms with no overshoot.
- Ring ends are round when the project's corner radius is above zero and square when it is zero.
- Reduced motion: the rings appear complete, and changes are instant.
Sound
- A soft tick each time the cursor lands on a different ring, at most one every 40 ms.
Sound is off until the visitor turns it on. Pass sound={false} to keep this component silent. How sound works
Accessibility
- The chart is one tab stop. It is exposed as a slider whose value text is the ring under the cursor, for example “North: 82% of 100%, 82%”.
- A visually hidden table lists every ring with its value and its share of the maximum.
- Colour is never the only key: each ring is named at its start, or in the legend on a narrow box, and the ring under the cursor shows its name, value and share in the centre.
- Each ring's full width, gap included, is the pointer target; the empty track shows how far the ring could go.
| Keys | Action |
|---|---|
| Tab | Focus the chart. The cursor goes to the innermost ring. |
| ← → | Move the cursor one ring out or in. |
| Home / End | Jump to the outermost or innermost ring. |
| Esc | Hide the cursor and show the total again. |
Source
The source comes with Pro
TypeScript source · Copy-paste ready · MIT-compatible for client projects · Includes all dependencies
Files and dependencies
- Adds
components/ui/radial-bar-chart.tsx- Packages
motion- Brings along
- Chart foundationsMotion tokensSound engineChart tooltip
Changelog
- 1.0.0 · 2026-12-03First release.