Charts
DonutChart
Circular donut chart with center label โ great for proportional breakdowns.
Quick Preview
Installation
npm install recharts
// Copy component fromsrc/components/charts/DonutChart.tsx
Usage
import DonutChart from '@/components/charts/DonutChart'<DonutChartdata={[{ name: 'A', value: 400 },{ name: 'B', value: 300 },{ name: 'C', value: 200 },]}centerLabel="Total"height={280}/>
Examples
Budget Allocation โ Custom Colors
Thin Ring โ 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* | DonutSlice[] | - | Array of {name, value, color?} |
centerLabel | string | - | Label below the center value |
centerValue | string | number | - | Override computed total |
height | number | 300 | Chart height in px |
showLegend | boolean | true | Show legend |