Pie Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Simple static & beautifully designed pie charts with donut, gradient, and glow effects
Installation
Usage
The pie chart is composible. <BeePieChart> is the container, and you compose only the parts you need — <Legend>, <Tooltip>, <Background>, and one <Pie> — as its children. The <Pie> carries its own shape props (innerRadius, paddingAngle, cornerRadius, …), its isClickable flag, and glowingSectors, so a single chart can mix any combination of those.
import {
BeePieChart,
Pie,
Label,
Tooltip,
Legend,
Background,
} from "@/components/beecharts/charts/pie-chart";const data = [
{ browser: "chrome", visitors: 275 },
{ browser: "safari", visitors: 200 },
{ browser: "firefox", visitors: 187 },
];
const chartConfig = {
chrome: {
label: "Chrome",
colors: { light: ["#3b82f6"], dark: ["#60a5fa"] },
},
safari: {
label: "Safari",
colors: { light: ["#10b981"], dark: ["#34d399"] },
},
firefox: {
label: "Firefox",
colors: { light: ["#f59e0b"], dark: ["#fbbf24"] },
},
} satisfies ChartConfig;<BeePieChart data={data} dataKey="visitors" nameKey="browser" config={chartConfig}>
<Legend isClickable />
<Tooltip />
<Pie isClickable innerRadius={60} paddingAngle={4} cornerRadius={8}>
<Label />
</Pie>
</BeePieChart>Interactive Selection
Add isClickable to the <Pie> (and to <Legend>) to make sectors selectable. Use the onSelectionChange callback on <BeePieChart> to handle selection events:
<BeePieChart
data={data}
dataKey="visitors"
nameKey="browser"
config={chartConfig}
onSelectionChange={(selection) => {
if (selection) {
console.log("Selected:", selection.dataKey, "Value:", selection.value);
} else {
console.log("Deselected");
}
}}
>
<Legend isClickable />
<Tooltip />
<Pie isClickable />
</BeePieChart>More examples
Donut, padding, label, and glow previews from the Recharts-era docs are being ported. The live preview above is ex-pie-chart.
API Reference
The chart is composed of several parts. The props below are grouped by the component they belong to.
The root container. It owns the data, the shared selection state, and the loading skeleton. Everything visual is composed as its children.
The pie series. Self-contained — it generates its own radial color gradients and glow filters, so any number of pies can live on one page without style collisions. Compose a <Label /> inside it to draw labels on each sector.
Per-sector labels composed inside a <Pie />. It renders nothing on its own — the parent <Pie /> reads its props and draws a label list over the sectors.
The hover tooltip. Hidden automatically while the chart is loading.
The sector legend. When isClickable is set, each entry toggles selection of its sector.
An optional decorative pattern drawn behind the pie. Compose it before the <Pie /> so it sits underneath the sectors.