A radar chart without JavaScript: the server computes the SVG, tooltips and highlighting work through :hover, :focus-visible and :has(). Axis labels sit outside the plot and never get clipped, series grow from the center as the chart scrolls into view, and a hidden table repeats the data for screen readers.
Browser Support
Feature
Baseline
Your browser
:has()
Dims the other series on interaction.
Your browser:
Scroll-driven animations
Draws the chart as it enters view.
Your browser:
Preview
Hover a point or move between points with Tab: the tooltip and highlighting work without JavaScript. Hover a legend item to highlight its series.
| Skill | Junior | Senior | Team average |
|---|---|---|---|
| Layout | 7 | 9 | 8 |
| Typography | 5 | 8 | 6 |
| Accessibility | 3 | 8 | 6 |
| Performance | 4 | 9 | 6 |
| Testing | 2 | 7 | 5 |
| Animation and motion | 6 | 7 | 5 |
Installation
Usage
import { RadarChart } from "@/components/ui/radar-chart"
const axes = [
{ key: "layout", label: "Layout" },
{ key: "typography", label: "Typography" },
{ key: "accessibility", label: "Accessibility" },
{ key: "performance", label: "Performance" },
{ key: "testing", label: "Testing" },
]
export default function Example() {
return (
<RadarChart
title="Skill profile"
axes={axes}
max={10}
series={[
{ name: "Junior", values: { layout: 7, typography: 5, accessibility: 3, performance: 4, testing: 2 } },
{ name: "Senior", values: { layout: 9, typography: 8, accessibility: 8, performance: 9, testing: 7 } },
]}
/>
)
}Examples
Circular grid
grid="circle" draws rings instead of polygons. A series can take its own color, otherwise it gets --chart-1…5 in order.
| Criterion | Model A | Model B |
|---|---|---|
| Battery | 4 / 5 | 5 / 5 |
| Camera | 5 / 5 | 3 / 5 |
| Screen | 4 / 5 | 3 / 5 |
| Price | 2 / 5 | 4 / 5 |
| Weight | 3 / 5 | 4 / 5 |
<RadarChart
grid="circle"
levels={5}
max={5}
axes={axes}
formatValue={(v) => `${v} / 5`}
series={[
{ name: "Model A", values: { battery: 4, camera: 5, screen: 4, price: 2, weight: 3 } },
{ name: "Model B", color: "var(--primary)", values: { battery: 5, camera: 3, screen: 3, price: 4, weight: 4 } },
]}
/>Single series
Without max the scale follows the largest value. The legend can be turned off.
| Criterion | Model A |
|---|---|
| Battery | 80 |
| Camera | 95 |
| Screen | 70 |
| Price | 40 |
| Weight | 60 |
<RadarChart
showLegend={false}
levels={3}
axes={axes}
series={[{ name: "Model A", color: "var(--foreground)", values }]}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| axes | { key: string; label: string }[] | - | Axes in clockwise order starting from the top |
| series | { name: string; values: Record<string, number>; color?: string }[] | - | Series: name, values by axis key and an optional color |
| max | number | - | Scale maximum. By default the largest value |
| levels | number | 4 | Number of grid rings |
| grid | "polygon" | "circle" | "polygon" | Grid shape |
| showLegend | boolean | true | Show the legend |
| formatValue | (value: number) => string | String | Formats values in the tooltip and the table |
| title | string | "Radar chart" | Accessible name and caption of the hidden table |
| axisHeader | string | "Axis" | First column header of the hidden table |
| duration | number | 700 | Draw-in duration in ms for browsers without scroll-driven animations |
| plotClassName | string | - | Classes for the plot box; its padding is the room for labels |
| className | string | - | Additional CSS classes |
Features
- No JavaScript: a Server Component, nothing is sent to the browser
- No dependencies: hand-written SVG, colors from --chart-1…5
- Labels outside the plot: anchored by direction, long labels wrap
- Draw-in: series grow from the center as the chart scrolls in, off with reduced motion
- Keyboard: every point is a Tab stop and shows its tooltip on focus
- Screen readers: a visually hidden table holds every value