import { DonutChart } from "@senvenli/react/charts";
const CHANNELS = [
{ name: "Website", value: 1840 },
{ name: "Mobile app", value: 1265 },
{ name: "Marketplace", value: 720 },
{ name: "Phone", value: 215 },
];
export default function Example() {
return <DonutChart title="Orders by channel" period="March 2026" data={CHANNELS} centerLabel="orders" />;
}import { DonutChart } from "@senvenli/react/charts";Examples
More than five parts
The smallest parts fold into "Other", so the ring stays readable.import { DonutChart } from "@senvenli/react/charts";
const COUNTRIES = [
{ name: "United States", value: 412000 },
{ name: "Germany", value: 186000 },
{ name: "United Kingdom", value: 154000 },
{ name: "Canada", value: 98000 },
{ name: "France", value: 71000 },
{ name: "Spain", value: 43000 },
{ name: "Netherlands", value: 29000 },
];
const usd = new Intl.NumberFormat("en", { style: "currency", currency: "USD", notation: "compact" });
export default function Example() {
return <DonutChart title="Revenue by country" period="2026" data={COUNTRIES} valueFormatter={usd.format} />;
}Ring only
Without the value list, for a narrow card.import { DonutChart } from "@senvenli/react/charts";
const PLANS = [
{ name: "Free", value: 5200 },
{ name: "Team", value: 1900 },
{ name: "Enterprise", value: 340 },
];
export default function Example() {
return <DonutChart title="Customers by plan" data={PLANS} centerLabel="customers" showList={false} height={200} />;
}Guidelines
When to use it
- Shares of one total, at most five parts.
Use something else when
- There are many parts or they are compared, not summed. Bar list
Accessibility
Built in
- A "Show as table" button shows the same data as a table, which screen readers get by default.
You provide
- A title that says what the figure is.
API reference
DonutChart
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | – | What the chart shows, over it; leave it out when a card or a heading already says so. |
aria-label | string | – | Names the chart when it has no visible |
period | string | – | |
isLoading | boolean | – | |
emptyState | React.ReactNode | – | Shown instead of the plot when there is no data: an |
height | number | 200 | |
dataRequired | readonly DonutDatum[] | – | Two to five parts; more are folded into "Other". |
valueFormatter | ChartValueFormatter | plain | |
centerLabel | string | – | Under the total in the center: its unit ("orders"). |
showList | boolean | true | The value list beside the ring with exact percentages; on by default. |
titlestringWhat the chart shows, over it; leave it out when a card or a heading already says so.
aria-labelstringNames the chart when it has no visible
title(a card's heading already says what it shows).periodstringisLoadingbooleanemptyStateReact.ReactNodeShown instead of the plot when there is no data: an
EmptyState size="small"or text; "No data" by default.heightnumberDefault200dataRequiredreadonly DonutDatum[]Two to five parts; more are folded into "Other".
valueFormatterChartValueFormatterDefaultplaincenterLabelstringUnder the total in the center: its unit ("orders").
showListbooleanDefaulttrueThe value list beside the ring with exact percentages; on by default.