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

BarChart

Pass data as an array of { label, value } objects. Colours default to the interactive palette or can be set per bar.

010203040PassFailN/ATo do
CategoryValue
Pass42
Fail8
N/A12
To do24
import { BarChart } from '@eekodigital/raster';

<BarChart
  data={[
    { label: 'Pass', value: 42 },
    { label: 'Fail', value: 8 },
    { label: 'N/A', value: 12 },
    { label: 'To do', value: 24 },
  ]}
  colors={['var(--color-success)', 'var(--color-danger)', 'var(--color-inactive)', 'var(--color-warning)']}
  aria-label="Conformance results by status"
/>
05101520PerceivableOperableUnderstandableRobust
CategoryValue
Perceivable18
Operable24
Understandable12
Robust6
<BarChart
  data={[...]}
  height={240}
  aria-label="Criteria by WCAG principle"
/>
  • SVG has role="img" with aria-label
  • Each bar is focusable with a descriptive aria-label (e.g. “Pass: 42”)
  • Arrow keys navigate between bars
  • A hidden <table> provides the same data for screen readers
PropTypeDefaultDescription
dataBarDatum[]

Array of { label: string, value: number }

colorsstring[]Interactive paletteColours per bar (CSS values or custom properties)
heightnumber200Chart height in pixels
aria-labelstringRequired. Describes the chart for screen readers.
classNamestring