Skip to content
Thrum

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-chart

This is a Pro component. The command works once your project has a licence key: set up Pro or see pricing.

Data shape

Type
axes: readonly string[]; // clockwise from the top

type RadarChartSeries = {
  key: string;
  name: string;
  values: readonly (number | null)[]; // one per axis
  color?: string;
};
Sample
[
  { key: "acme", name: "Acme", values: [8, 6, 9, null] },
  { key: "northwind", name: "Northwind", values: [6, 9, 7, 8] },
]

Props

PropTypeDefaultDescription
axesreadonly string[]RequiredNames of the axes, clockwise from the top. Three to eight read best.
seriesreadonly RadarChartSeries[]RequiredOne to three series. More are drawn, but the shapes stop being readable.
labelstringRequiredWhat the chart compares. Read by screen readers and used as the table caption.
maxnumber–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.
ringsnumberDefault 4About how many grid lines from the centre to the edge. They fall on round values.
formatIntl.NumberFormatOptionsDefault compactHow values are written on the grid, in the readout and in the data table.
localestringDefault "en-US"Locale for number formatting.
legendbooleanDefault trueShow the interactive legend above the chart. Its buttons switch series on and off; the last visible series stays on.
hiddenreadonly string[]–Keys of the hidden series, when the parent controls them.
defaultHiddenreadonly 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.
soundbooleanDefault truePlay a tick as the cursor moves between axes, if the visitor has sound on.
emptyLabelstringDefault "No data"Text shown when there is nothing to draw.
classNamestring–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.
KeysAction
TabFocus 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 / EndJump to the first or last axis.
EscHide the cursor.

Source

SourcePro

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. 1.0.0 · 2026-12-03First release.

Loading index…

Keyboard shortcuts

/Ctrl KSearch components, docs and actions
?Show this list
AAppearance studio
SSound on or off
MFull or reduced motion
TTheme: auto, light, dark
GSurface: solid or frosted
BBackdrop photograph (under glass)
CCorner radius: square to round
RReplay the demo, on a component page
DDraw new data, on a component page
←→HomeEndMove the cursor in a focused chart
EscClose a dialog, or leave a chart cursor