Interactive Answers

Radar Chart

Scores across several axes as a polygon, with a dashed bar to meet and each member's values as dots on the spokes.

3 variantsMIT

Preview

Installation

Copies the component into components/ui and installs its dependencies and theme tokens.

pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/radar-chart.json

Usage

Pass your own data and wire the callbacks to your agent runtime.

import { RadarChart } from "@/components/ui/radar-chart";

export function TeamSkills({ review }: { review: SkillsReview }) {
  return (
    <RadarChart
      title="Team skills"
      subtitle={`${review.team} · ${review.cycle}`}
      axes={review.skills} // "Craft", "Systems thinking", …
      max={4}
      series={{ id: "avg", label: "Team average", values: review.average }}
      baseline={{ label: "Senior bar", values: review.bar }}
      members={review.people.map((p) => ({
        id: p.id,
        label: p.initials,
        name: p.name,
        values: p.scores,
      }))}
      headline={{ value: review.overall.toFixed(1), caption: "bar 3.0" }}
      onSelect={(axis) => openRubric(review.skills[axis])}
    />
  );
}

// Pass null while the review request is in flight; keep stale data and set
// loading when refetching.
export function SkillsState({ query }: { query: ReviewQuery }) {
  return (
    <RadarChart
      title="Team skills"
      axes={query.data?.axes ?? null}
      max={4}
      series={query.data?.series ?? null}
      baseline={query.data?.baseline ?? null}
      members={query.data?.members ?? null}
      headline={query.data?.headline ?? null}
      loading={query.isRefetching}
      skeleton={{ count: 6 }}
    />
  );
}

Props

PropTypeDefaultDescription
axes*string[] | null—One label per axis, clockwise from the top. Five to eight read best.
max*number—Top of the scale, drawn as the outer ring. Up to 10 gets a ring per step, otherwise four.
series*RadarSeries | null—The filled polygon, e.g. a team average. Its values label each axis.
baseline{ label: string; values: number[] } | null—A dashed polygon to measure against, like the bar for a level.
membersRadarMember[] | null[]Individual values drawn as dots on each spoke. Hovering an axis lists them all.
loadingbooleanfalseForce the fixed-footprint skeleton while refetching, even when stale radar data is available.
skeleton{ count?: number }—Loading footprint hint for the number of axes. Falls back to stale axes, then 6.
title*string—Header title.
subtitlestring—Secondary line under the title.
headline{ value: string; caption?: string } | null—Number on the right of the header, with a short caption.
format(value: number) => stringv.toFixed(1)Formats every value: axis labels, tooltip and screen reader text.
onSelect(axis: number) => void—Called when an axis is hovered or reached with the arrow keys.
labelsPartial<RadarChartLabels>—Your own UI strings (loading announcement and screen-reader text), for translating. Right-to-left works under `dir="rtl"`; axes still run clockwise.
classNamestring—Extra classes for the root element.
type RadarSeries = {
  id: string;
  label: string;
  values: number[]; // one per axis, 0…max
  color?: string;   // defaults to brand
};

type RadarMember = {
  id: string;
  label: string;    // short, e.g. initials
  name?: string;    // full name for screen readers
  values: number[]; // one per axis, 0…max
  color?: string;   // defaults to blue, teal, purple, gold
};