Donut Chart

Single value donut chart in SVG that fills an accent ring to a percentage of max and prints the percent in the middle. Labelled as an image for screen readers.

src/registry/ui/donut-chart.tsx/r/donut-chart.json

Installation#

bash
npx shadcn@latest add @minidev/donut-chart

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/donut-chart.json

Usage#

tsx
import { DonutChart } from "@/components/ui/donut-chart"

export function Example() {
  return (
    <DonutChart value={72} label="Completion" />
  )
}

API reference#

DonutChart props
PropTypeDefault
value*number-
maxnumber100
classNamestring-
labelstring"Donut"

* required

Examples#

All chart components

Learn more