Radar chart
One to three things compared across three to eight qualities, each drawn as an outlined shape: vendor scores, skill profiles, product ratings. It shows the shape of a profile at a glance; for exact comparison of a few values, a bar chart reads faster.
Install
npx shadcn@latest add @thrum-pro/radar-chartThis is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.
Data shape
axes: readonly string[]; // clockwise from the top
type RadarChartSeries = {
key: string;
name: string;
values: readonly (number | null)[]; // one per axis
color?: string;
};[
{ key: "acme", name: "Acme", values: [8, 6, 9, null] },
{ key: "northwind", name: "Northwind", values: [6, 9, 7, 8] },
]Props
| Prop | Type | Default | Description |
|---|---|---|---|
axes | readonly string[] | Required | Names of the axes, clockwise from the top. Three to eight read best. |
series | readonly RadarChartSeries[] | Required | One to three series. More are drawn, but the shapes stop being readable. |
label | string | Required | What the chart compares. Read by screen readers and used as the table caption. |
max | number | – | The value at the outer edge. Defaults to the highest value rounded up to a grid line. Values above it stop at the edge; values below zero sit at the centre. |
grid | "polygon" | "circle" | Default "polygon" | Grid lines as polygons that follow the axes, or as circles. |
rings | number | Default 4 | About how many grid lines from the centre to the edge. They fall on round values. |
format | Intl.NumberFormatOptions | Default compact | How values are written on the grid, in the readout and in the data table. |
locale | string | Default "en-US" | Locale for number formatting. |
legend | boolean | Default true | Show the interactive legend above the chart. Its buttons switch series on and off; the last visible series stays on. |
hidden | readonly string[] | – | Keys of the hidden series, when the parent controls them. |
defaultHidden | readonly string[] | – | Keys of the series hidden at first, when the chart keeps the state itself. |
onHiddenChange | (hidden: string[]) => void | – | Called with the new list of hidden keys when a legend item is pressed. |
onActiveChange | (index: number | null) => void | – | Called with the index of the axis under the cursor, or null when the cursor leaves. |
sound | boolean | Default true | Play a tick as the cursor moves between axes, if the visitor has sound on. |
emptyLabel | string | Default "No data" | Text shown when there is nothing to draw. |
className | string | – | Sets the size. The default is full width and 256 pixels tall, legend included. The chart is as large as the smaller side allows. |
Motion and sound
Motion
- First draw: each shape grows out of the centre in 250 ms, the next series 40 ms later.
- New data with the same axes: each shape moves to its new outline in 400 ms with no overshoot. A different number of axes is drawn again at once.
- The cursor dots and the readout follow the pointer on a stiff spring.
- Reduced motion: the chart appears complete, and data changes and the cursor move instantly.
Sound
- A soft tick each time the cursor lands on a different axis, at most one every 40 ms.
- A soft click when a legend item toggles a series on or off.
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, exposed as a slider whose value text is the axis under the cursor with every series, for example “Support: Acme 6, Northwind 9”.
- A visually hidden table carries every value, one row per axis and one column per series.
- Axis labels shrink to fit before the chart does: at 160 px they are cut with an ellipsis and keep the full name as a tooltip, in the readout and in the table.
- Series are named in the legend and in the readout. Each shape has a 2 px outline in full colour, so it keeps 3:1 against the background even where the fills overlap.
- The readout is a floating surface. Under frosted glass it turns translucent and keeps its text at 4.5:1.
| Keys | Action |
|---|---|
| Tab | Focus the chart. The cursor goes to the last axis. |
| ← → | Move the cursor one axis. Past the last axis it goes round to the first, and back. |
| Home / End | Jump to the first or last axis. |
| Esc | Hide the cursor. |
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/radar-chart.tsx- Packages
motion- Brings along
- Chart foundationsMotion tokensSound engineChart tooltip
Changelog
- 1.0.0 · 2026-12-03First release.