Skip to content
WANCRAFT

G.88Data & Feedback

Radar Chart

A spider chart for up to three series whose polygons spring between datasets.

NewReactSVGTailwindadvanced

Overview

Radar Chart plots one to three series over any number of axes in SVG. Every vertex rides its own spring, so a new dataset, a series toggled in the legend or the first appearance all morph the polygons organically rather than jumping. Grid rings can be polygons or circles, axis labels are anchored around the outside by angle, and ring values run up the first spoke. Hovering, tapping or focusing an axis highlights it and shows a tooltip with every visible series' value; the axes are a single tab stop with arrow-key navigation, and a visually hidden table carries the full data. The chart sizes itself to its container with a ResizeObserver.

01Installation

Method 01 · Registry

CLI verified

Uses the shadcn CLI in a project initialised with shadcn init. Installs the file to components/ui/radar-chart.tsx and adds its dependencies.

npx shadcn@latest add https://wancraft.my/r/radar-chart.json

Method 02 · Copy and paste

  1. 1. No extra dependencies — React and Tailwind CSS only.
  2. 2. Copy the source from the Code tab into components/ui/radar-chart.tsx.
  3. 3. Import it and adjust props.
Dependencies
None
Peer
react ≥ 18, tailwindcss ≥ 4
Added
13 Oct 2026
Updated
—

02Usage

The default configuration. Change properties above to generate a tailored example in the Usage tab.

example.tsx
import { RadarChart, type RadarAxis, type RadarSeries } from "@/components/ui/radar-chart";

export function RadarChartExample() {
  const axes: RadarAxis[] = [
    { key: "speed", label: "Speed" },
    { key: "craft", label: "Craft" },
    { key: "access", label: "Access" },
    { key: "motion", label: "Motion" },
    { key: "docs", label: "Docs" },
  ];
  const series: RadarSeries[] = [
    { id: "a", label: "Studio A", values: { speed: 82, craft: 64, access: 90, motion: 58, docs: 71 } },
    { id: "b", label: "Studio B", values: { speed: 55, craft: 88, access: 62, motion: 79, docs: 48 } },
  ];

  return (
    <RadarChart label="Studio scorecard" axes={axes} series={series} />
  );
}

03Props

PropTypeDefaultDescription
axes{ key: string; label: string }[]—Axes, clockwise from twelve o'clock (required).
series{ id: string; label: string; values: Record<string, number>; color?: string }[]—One to three series (required). Pass new values to morph; ids keep colours stable.
labelstring—Accessible name and caption of the screen-reader table (required).
maxnumber0Value at the outer ring; 0 picks a rounded maximum from all series.
levelsnumber4Number of grid rings.
gridShape"polygon" | "circle""polygon"Grid ring shape.
spring{ stiffness: number; damping: number; mass: number }{ stiffness: 170, damping: 20, mass: 1 }Spring for every vertex.
fillOpacitynumber0.15Opacity of the series fill.
showDotsbooleantrueDraw a dot on every vertex.
format(value: number) => string—Formatter for tooltip, ring values and table.
legendbooleantrueShow the legend toggles (with two or more series).
maxSizenumber440Maximum chart size in px; it shrinks with the container (minimum 200).
accentstring"#FF7448"Colour of the first series without its own colour.

04Features

  • 01Per-vertex springs: datasets, toggles and entry all morph
  • 02Polygon or circular grid with ring values on the first spoke
  • 03Axis labels anchored by angle around the chart
  • 04Hover, tap or keyboard focus on an axis shows a tooltip for every visible series
  • 05Legend toggles series; colours follow the series id (accent + two CVD-checked slots)
  • 06Responsive via ResizeObserver; spring loop pauses offscreen and in hidden tabs
motion · springinput · hoverinput · clickinput · keyboardinput · focus

05Accessibility

  • Axes form a single tab stop (roving tabindex); arrow keys, Home and End move between axes and Escape hides the tooltip.
  • Each axis is a list item labelled with every visible series' value, so the tooltip content is also spoken.
  • Legend items are buttons with aria-pressed.
  • A visually hidden table lists every axis × series value.
  • Focused axes get a visible dashed outline; series identity is shown by legend and tooltip labels, never colour alone.
  • With prefers-reduced-motion polygons jump straight to their values.

06Limitations

  • Designed for one to three series; beyond three, extra series fall back to a neutral colour and the chart gets hard to read.
  • Polygons are drawn on the client after hydration; the server HTML contains the grid, labels and table.