GooseUI

Components

Radar Chart

New

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

: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 profile
SkillJuniorSeniorTeam average
Layout798
Typography586
Accessibility386
Performance496
Testing275
Animation and motion675

Installation

npx shadcn@latest add @gooseui/radar-chart
pnpm dlx shadcn@latest add @gooseui/radar-chart
yarn dlx shadcn@latest add @gooseui/radar-chart
bunx --bun shadcn@latest add @gooseui/radar-chart

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.

Product comparison
CriterionModel AModel B
Battery4 / 55 / 5
Camera5 / 53 / 5
Screen4 / 53 / 5
Price2 / 54 / 5
Weight3 / 54 / 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.

Product comparison
CriterionModel A
Battery80
Camera95
Screen70
Price40
Weight60
<RadarChart
  showLegend={false}
  levels={3}
  axes={axes}
  series={[{ name: "Model A", color: "var(--foreground)", values }]}
/>

Props

PropTypeDefaultDescription
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
maxnumber-Scale maximum. By default the largest value
levelsnumber4Number of grid rings
grid"polygon" | "circle""polygon"Grid shape
showLegendbooleantrueShow the legend
formatValue(value: number) => stringStringFormats values in the tooltip and the table
titlestring"Radar chart"Accessible name and caption of the hidden table
axisHeaderstring"Axis"First column header of the hidden table
durationnumber700Draw-in duration in ms for browsers without scroll-driven animations
plotClassNamestring-Classes for the plot box; its padding is the room for labels
classNamestring-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