Simulates prefers-reduced-motion for the demo. Off follows your system setting.
Steps focus through the demo with ] and [. Tab, arrows, and Escape stay native so the component behaves as shipped.
1
| Slice | Value | Share |
|---|---|---|
| Direct | 4.2K | 39% |
| Search | 3.1K | 29% |
| Social | 1.8K | 17% |
| Referral | 950 | 9% |
| 620 | 6% |
A ring of soft rounded slices that shows how a total breaks down.
npx shadcn@latest add ikislay/pixel-ui/donut-chartimport { DonutChart } from "@/components/ui/donut-chart"const data = [{ label: "Direct", value: 4200 },{ label: "Search", value: 3100 },{ label: "Social", value: 1800 },]export function Demo() {return <DonutChart label="Traffic by source" data={data} totalLabel="Visits" />}
1// Loading…
Options you can pass to customize this component.
data*{ label: string; value: number; color?: string }[]One entry per slice. Colors follow the chart palette in order unless you set one.
label*stringNames the chart for screen readers and captions its data table.
format(value: number) => stringFormats values wherever the chart shows them. Defaults to short numbers like 12.4K.
thicknessnumberWidth of the ring, on a 200 unit wide chart.
totalLabelstringThe caption under the total in the center.
classNamestringMerged onto the root element.