Donut chart
How a total splits into a few parts, as a ring with the sum in the middle.
Revenue by channel
Oct 26 – Nov 1, 2026
- Dine-in
- Delivery apps
- Takeaway
- Catering
Installation
npm i @uisatin/uiimport { DonutCard } from '@uisatin/ui/donut-chart'About 48.6 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/donut-chart.jsonAdds donut-chart.tsx, badge.tsx, chart.tsx, dropdown.tsx, floating.tsx, form-field.tsx, kbd.tsx, labels.tsx, pointer-modality.tsx and select.tsx to components/ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The DonutCard component is a wrapper around the div element with the title and a period Select, the range, a ring with the sum in the middle and a legend pill per part. Hovering a part or its pill brings it forward and shows its value and share in the middle.
| Prop | Type | Default |
|---|---|---|
title | string | — |
range | string | — |
data | ChartDatum[] | — |
centerLabel | string | "Total" |
periods | string[]string[][] | — |
value | string | — |
onPeriodChange | (period) => void | — |
formatValue | (value) => string | — |
highlight | number | — |
Accessibility
The card is role="figure" labelled by its title. The ring is hidden. The legend is a list named after the title; each pill is a tab stop named "label: value, share%". The middle of the ring is a polite live region, so moving to a part reads its value and share.
| Key | Action |
|---|---|
| TaborShift+Tab | Moves from part to part and shows its value in the middle. |
Something wrong or missing on this page?
Report a problemSuggest an improvement