Skip to content
  • System
  • Light
  • Dark
  • High contrast

DonutChart

Each datum has a label, value, and color. Children render in the centre.

86criteria
CategoryValuePercentage
Pass4249%
Fail89%
N/A1214%
To do2428%
import { DonutChart } from '@eekodigital/raster';

<DonutChart
  data={[
    { label: 'Pass', value: 42, color: 'var(--color-success)' },
    { label: 'Fail', value: 8, color: 'var(--color-danger)' },
    { label: 'N/A', value: 12, color: 'var(--color-inactive)' },
    { label: 'To do', value: 24, color: 'var(--color-warning)' },
  ]}
  aria-label="Conformance summary"
>
  <strong>86</strong>
  <span>criteria</span>
</DonutChart>

Use smaller size and thickness for inline progress indicators.

75%
CategoryValuePercentage
Complete7575%
Remaining2525%
<DonutChart
  data={[
    { label: 'Complete', value: 75, color: 'var(--color-success)' },
    { label: 'Remaining', value: 25, color: 'var(--color-border)' },
  ]}
  size={80}
  thickness={10}
  aria-label="75% complete"
>
  <strong>75%</strong>
</DonutChart>
  • SVG has role="img" with aria-label
  • Each segment is focusable with label, value, and percentage announced
  • Arrow keys navigate between segments (wraps around)
  • A hidden <table> provides the data with percentages for screen readers
  • Zero-value segments are skipped (not rendered or focusable)
PropTypeDefaultDescription
dataDonutDatum[]

Array of { label, value, color }

sizenumber160Diameter in pixels
thicknessnumber24Ring thickness in pixels
childrenReactNodeCentre content (summary text, number, etc.)
aria-labelstringRequired. Describes the chart.
classNamestring