Provides a <MaidrNivo> wrapper component, a useNivoAdapter hook and a
pure nivoToMaidr converter for making Nivo charts accessible through
MAIDR's audio sonification, text descriptions, braille output, and keyboard
navigation.
Remarks
Requires React 18 or 19. The adapter never imports a @nivo/* package: it
reads the props the chart is rendered with, so the chart kind is declared
with type. Highlighting uses the data-testid/data-key attributes Nivo
stamps on its SVG marks, and tags line and scatter marks with
data-maidr-nivo-* attributes after render.
Supported chart kinds (SVG components; the *Canvas variants are read but
not highlighted):
'bar' → @nivo/bar: bar, stacked bar, grouped (dodged) bar, and
layout="horizontal" for each
'line' → @nivo/line: line chart (step chart for the step curves)
'scatterplot' → @nivo/scatterplot: one scatter layer per series
'pie' → @nivo/pie: pie chart (a doughnut with innerRadius)
'heatmap' → @nivo/heatmap: heat map
'boxplot' → @nivo/boxplot: box plot, vertical or horizontal
Example: Using the wrapper component
import { MaidrNivo } from'maidr/nivo'; import { Bar } from'@nivo/bar';
Public Nivo adapter API for MAIDR.
Provides a
<MaidrNivo>wrapper component, auseNivoAdapterhook and a purenivoToMaidrconverter for making Nivo charts accessible through MAIDR's audio sonification, text descriptions, braille output, and keyboard navigation.Remarks
Requires React 18 or 19. The adapter never imports a
@nivo/*package: it reads the props the chart is rendered with, so the chart kind is declared withtype. Highlighting uses thedata-testid/data-keyattributes Nivo stamps on its SVG marks, and tags line and scatter marks withdata-maidr-nivo-*attributes after render.Supported chart kinds (SVG components; the
*Canvasvariants are read but not highlighted):'bar'→@nivo/bar: bar, stacked bar, grouped (dodged) bar, andlayout="horizontal"for each'line'→@nivo/line: line chart (step chart for the step curves)'scatterplot'→@nivo/scatterplot: one scatter layer per series'pie'→@nivo/pie: pie chart (a doughnut withinnerRadius)'heatmap'→@nivo/heatmap: heat map'boxplot'→@nivo/boxplot: box plot, vertical or horizontalExample: Using the wrapper component
Example: Using the hook with `<Maidr>`