ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
title: Pie Chart
description: A customizable pie chart component to visualize proportional data with support for donut charts. š°
lastUpdated: 12 Aug, 2025
links:
source: https://github.com/Logging-Stuff/RetroUI/blob/main/components/retroui/charts/PieChart.tsx
<ComponentShowcase name="pie-chart-style-default" />
<br />
<br />
Installation
<ComponentInstall>
<ComponentInstall.Cli npmCommand="npx shadcn@latest add 'https://retroui.dev/r/pie-chart.json'" />
<ComponentInstall.Manual>
1. Install dependencies:
npm install recharts
<br />
2. Copy the code š into your project:
<ComponentSource name="pieChart" />
</ComponentInstall.Manual>
</ComponentInstall>
<br />
<br />
Examples
Default
<ComponentShowcase name="pie-chart-style-default" />
<br />
<br />
Donut Chart
<ComponentShowcase name="pie-chart-style-donut" />
<br />
<br />
API Reference
<Table>
<Table.Header>
<Table.Row>
<Table.Head>Prop</Table.Head>
<Table.Head>Type</Table.Head>
<Table.Head>Default</Table.Head>
<Table.Head>Description</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell className="font-medium">data</Table.Cell>
<Table.Cell className="*:text-xs">`Record<string, any>[]`</Table.Cell>
<Table.Cell className="*:text-xs">`[]`</Table.Cell>
<Table.Cell>Array of data objects to display</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">dataKey</Table.Cell>
<Table.Cell className="*:text-xs">`string`</Table.Cell>
<Table.Cell className="*:text-xs">-</Table.Cell>
<Table.Cell>Key for the data values</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">nameKey</Table.Cell>
<Table.Cell className="*:text-xs">`string`</Table.Cell>
<Table.Cell className="*:text-xs">-</Table.Cell>
<Table.Cell>Key for the category names</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">colors</Table.Cell>
<Table.Cell className="*:text-xs">`string[]`</Table.Cell>
<Table.Cell className="*:text-xs">`["var(--chart-1)", ...]`</Table.Cell>
<Table.Cell>Array of colors for the pie segments</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">innerRadius</Table.Cell>
<Table.Cell className="*:text-xs">`number`</Table.Cell>
<Table.Cell className="*:text-xs">`0`</Table.Cell>
<Table.Cell>Inner radius (use > 0 for donut chart)</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">outerRadius</Table.Cell>
<Table.Cell className="*:text-xs">`number`</Table.Cell>
<Table.Cell className="*:text-xs">`80`</Table.Cell>
<Table.Cell>Outer radius of the pie</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">tooltipBgColor</Table.Cell>
<Table.Cell className="*:text-xs">`string`</Table.Cell>
<Table.Cell className="*:text-xs">`"var(--background)"`</Table.Cell>
<Table.Cell>Background color for tooltips</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">tooltipBorderColor</Table.Cell>
<Table.Cell className="*:text-xs">`string`</Table.Cell>
<Table.Cell className="*:text-xs">`"var(--border)"`</Table.Cell>
<Table.Cell>Border color for tooltips</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">valueFormatter</Table.Cell>
<Table.Cell className="*:text-xs">`(value: number) => string`</Table.Cell>
<Table.Cell className="*:text-xs">`(value) => value.toString()`</Table.Cell>
<Table.Cell>Function to format values</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">showTooltip</Table.Cell>
<Table.Cell className="*:text-xs">`boolean`</Table.Cell>
<Table.Cell className="*:text-xs">`true`</Table.Cell>
<Table.Cell>Whether to show tooltips on hover</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell className="font-medium">className</Table.Cell>
<Table.Cell className="*:text-xs">`string`</Table.Cell>
<Table.Cell className="*:text-xs">-</Table.Cell>
<Table.Cell>Additional CSS classes</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā
ā