Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

PieChart

Pie / donut chart with token-colored slices (up to 8 series), a hover-dim highlight, an optional donut center label, and an optional legend. Tooltips reuse ChartTooltipContent for visual parity with ChartFrame.

Import

PieChart is a registry composite — you own the source after installing:

npx ploxum add pie-chart
import { PieChart } from "@/components/pie-chart";

Requires recharts and depends on the chart-frame registry item (for ChartTooltipContent) plus @roger-emerson/ploxum-primitives (Card).

Usage

const severity = [
  { label: "Critical", value: 3 },
  { label: "High", value: 7 },
  { label: "Medium", value: 12 },
  { label: "Low", value: 9 },
];
 
<PieChart
  centerLabel={<strong>31</strong>}
  data={severity}
  innerRadius={56}
  showLegend
  subtitle="Open · last 24h"
  title="Incidents by severity"
  valueFormatter={(v) => `${v} open`}
/>;

innerRadius={0} (the default) renders a solid pie; any positive value makes a donut and reveals centerLabel in the hole.

Props

PropTypeDefaultDescription
titlestringCard header title.
dataPieDatum[]{ label, value, color? }[]. Slice color defaults to a chart-series token by index.
innerRadiusnumber0Donut hole radius in px; 0 = solid pie.
outerRadiusnumber88Outer radius in px.
centerLabelReactNodeShown in the donut hole (donut only).
showLegendbooleanfalseToken-colored legend row beneath the chart.
valueFormatter(n: number) => stringFormat slice values in the tooltip.
accent"none" | "amber""none"Card left-border accent.
heightnumber240Chart body height in px.
subtitle / className / refPassed through to Card.

Design rules

  • Slice colors come from --ploxum-color-chart-series1..8 — that's the hard cap. Don't exceed 8 categories in one pie; bucket the long tail into "Other".
  • Prefer a donut with a center total over a solid pie when the aggregate matters as much as the split.
  • Hover dims the other slices rather than exploding one out — keep it flat.

Storybook

Composites/PieChart ↗