Skip to content

PieChart

Slice shares by category. Channel traffic below is honest sample data, rendered as a static SVG with no tooltips.

Channel traffic

Pie chart, 4 segments, total 100Static pie chart of Pie chart. Slices read clockwise from the top.Direct: 40Referral: 25Search: 20Social: 15
  • Direct40
  • Referral25
  • Search20
  • Social15
<PieChart data={channels} />

Donut variant

Pass donut to punch the center and print the total (100).

Channel traffic, 4 segments, total 100Static pie chart of Channel traffic. Slices read clockwise from the top.Direct: 40Referral: 25Search: 20Social: 15100
  • Direct40
  • Referral25
  • Search20
  • Social15
<PieChart label="Channel traffic" data={channels} donut />

Props

PropTypeDefaultDescription
dataArray<{ label: string; value: number }>-Slices in document order; negative values clamp to zero.
donutbooleanfalseOverlay a surface circle and print the total in the center.
labelstring"Pie chart"Chart name; opens the auto-summary.
sizenumber220viewBox edge; the SVG scales to 100%.
classstring-Style passthrough.

Static honesty

Static SVG, no tooltips. Wedges are computed frontmatter paths (no JS runs in the browser); a single-slice chart draws as a circle. Colors cycle accent, success, info, warning, danger, muted in document order and stay dark-safe via global tokens. An all-zero total renders a border-state circle with a "no data" label instead of dividing by zero. The legend is a real <ul> with swatch, label, and value.

Accessibility