Skip to content
Browse docs and components

Donut Chart

donut-chart

Part of a whole as a ring with the total in the centre. The legend is a list of buttons with values and percentages, and hovering or tabbing through it lifts the slice and shows its value in the middle.

Responsive

Install

$npxshadcnadd@forme/donut-chart

Adds the component, its registry dependencies, and the token stylesheet you import once.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

DonutChart

Part of a whole, as a ring with the total in the middle.

PropTypeDefaultDescription
data*readonly DonutSlice[]—Five slices or fewer reads best; fold the tail into "Other".
label*string—
totalLabelstring"Total"What the centre says about the total: "Visitors", "Spend".
formatValue(value: number) => string(value) => value.toLocaleString("en-US")
sizenumber168The ring's outer diameter in pixels.
classNamestring—