Donut Chart

Charts

A pie chart with a hollow center and total.

Donut charts keep the proportion story of a pie while freeing the center for a headline metric. The total is computed automatically and a per-slice legend sits beside the ring.

npx shadcn@latest add donut-chart

Default

Spend breakdown with a centered total and side legend.

Preview
Live
100Total
  • Product48
  • Marketing22
  • Infra15
  • Support15
tsx
1<DonutChart data={spendBreakdown} height={240} />

Custom

A thicker ring in a taller container.

Preview
Live
100Total
  • Organic42
  • Direct26
  • Referral18
  • Social14
tsx
1<DonutChart data={trafficSources} height={280} innerRadius="70%" outerRadius="92%" />

API reference

All props of the underlying Base UI primitive are forwarded. The table below documents the Shelf-specific props.

PropTypeDescription
data{ name, value, color? }[]The slices to render.
heightnumber= 240The chart height in pixels.
innerRadiusnumber | string= "62%"The inner radius of the ring.
outerRadiusnumber | string= "86%"The outer radius of the ring.