---
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-studio/RetroUI/blob/main/components/retroui/charts/PieChart.tsx
---
## Installation
#### 1. Install dependencies:
```sh
npm install recharts
```
#### 2. Copy the code 👇 into your project:
## Examples
### Default
### Donut Chart
## API Reference
Prop
Type
Default
Description
data
`Record[]`
`[]`
Array of data objects to display
dataKey
`string`
-
Key for the data values
nameKey
`string`
-
Key for the category names
colors
`string[]`
`["var(--chart-1)", ...]`
Array of colors for the pie segments
innerRadius
`number`
`0`
Inner radius (use > 0 for donut chart)
outerRadius
`number`
`80`
Outer radius of the pie
tooltipBgColor
`string`
`"var(--background)"`
Background color for tooltips
tooltipBorderColor
`string`
`"var(--border)"`
Border color for tooltips
valueFormatter
`(value: number) => string`
`(value) => value.toString()`
Function to format values
showTooltip
`boolean`
`true`
Whether to show tooltips on hover
className
`string`
-
Additional CSS classes