Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Components
  2. Swatch
  3. Accessibility

Swatch

Accessibility

Swatch from @prepared911/ui/swatch exposes the same meaningful vs decorative contract as Shape and Image inline SVG. Paint tokens and DataColor do not replace accessible naming.
Meaningful vs decorative
ModePropsDOM
Meaningfullabel (LocalizedMessage); decorative omitted or falseRoot svg has role="img" and aria-label from label.
Decorativedecorative: trueRoot svg has aria-hidden="true" and focusable="false"; no role="img".
Passing both label and decorative: true, or neither, is a type error.
Legend keys beside text
In legend rows, tooltips, and layer lists, the adjacent Text (or equivalent) names the series. Set decorative: true on the swatch so assistive tech reads the name once from the label, not again from the graphic. Use meaningful mode (label) only when no neighboring copy names the mark (for example a swatch-only control). Write label as you would for a small Shape graphic.
Color is never the only carrier of meaning
Series keys must remain identifiable when hue is ambiguous. Swatch encodes that in geometry:
  • Line vs Circle vs Square distinguish geometry families.
  • Pattern variants add dashes, dots, hatch, or vertex markers so comparison and GIS symbology do not rely on color alone.
Still pair every row with visible series copy. Patterns and dashes supplement labels; they do not replace them on critical surfaces.
Contrast
Verify fill and stroke against the surface behind the svg. Token and ChartColor paint follow the theme; vendor DataColor values are not tuned for your background. On busy map or chart chrome, add a token stroke outline or choose a shape or pattern that stays visible in context.
Forced colors
Swatch and vector-paint styles do not define @media (forced-colors) overrides. High-contrast mode uses the browser default SVG painting; do not assume token or data colors survive unchanged.
Related
  • Data color accessibility
  • Shape accessibility
Previous
Swatch / API and Development
Next
Switch / Usage
On this page
Meaningful vs decorative
Legend keys beside text
Color is never the only carrier of meaning
Contrast
Forced colors
Related