Docs/Polar Components/Pie

Pie

Pie renders one sector per data entry, configurable by center, radii, angle range, and optional labels. It works inside a PieChart and respects Cell children for per-slice styling.

import { Pie, PieChart, ResponsiveContainer, Tooltip } from "solid-recharts";

<PieChart>
  <Pie data={data} dataKey="value" nameKey="name" cx="50%" cy="50%" outerRadius={80} />
  <Tooltip />
</PieChart>;
PieChart
pie-donut.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
dataobject[]—Source data array, one entry per slice; omit to use <Cell> children as data
dataKeystring | function—Key or accessor to extract the numeric value for each slice
nameKeystring"name"Key to extract the slice label for legend/tooltip
cxnumber | string"50%"Center x coordinate (px or %)
cynumber | string"50%"Center y coordinate (px or %)
innerRadiusnumber | string0Radius of the inner hole (donut); 0 = solid pie
outerRadiusnumber | string—Radius of the outer edge (required)
startAnglenumber0Starting angle in degrees (0 = 3 o'clock, clockwise)
endAnglenumber360Ending angle in degrees
paddingAnglenumber0Gap between sectors in degrees
labelboolean | object | functionfalseRender labels on sectors; object/function for customization
labelLineboolean | object | functiontrueConnector line from sector to label
activeShapeobject | function—Shape rendered on hover/active (merges props or calls function)
fillstring—Default slice color (overridden by <Cell>)

All other recharts Pie props are supported; see the recharts Pie docs for the full matrix.

Notes

  • Use <Cell> children (one per slice or in a <For> loop) to override fill and stroke per slice.
  • dataKey can be a function: dataKey={(entry) => entry.value}.
  • Angles are in degrees; 0° points right, increases clockwise.
  • innerRadius + outerRadius can be percentages of the chart area.
  • The label prop can render a function: label={(entry) => entry.name}.

See also