UI
PieChart
Pie and donut charts with percentage labels and custom colors via Recharts.
Preview
Installation
npm install recharts
Usage
import { PieChart } from '@/components/ui/PieChart'const data = [{ name: 'Chrome', value: 65 },{ name: 'Safari', value: 18 },{ name: 'Firefox', value: 8 },]export default function Page() {return <PieChart data={data} showLabel />}
Variants
Donut Chart
No Legend
Prompt Preview
Copy a prompt that recreates this UI
Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.
Copy-ready AI prompt
Starts from the current visual reference and project constraints.
Tweak only product-specific copy or data after the first generation pass.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
data* | PieChartDataPoint[] | - | Array of { name, value, color? } objects |
height | number | 300 | Chart height in pixels |
innerRadius | number | 0 | Inner radius for donut charts |
outerRadius | number | 100 | Outer radius of the pie |
showLegend | boolean | true | Show segment legend |
showTooltip | boolean | true | Show hover tooltip |
showLabel | boolean | false | Show percentage labels inside segments |
startAngle | number | 90 | Start angle for the first segment |
className | string | - | Extra CSS classes for the wrapper |