DocsShowcaseGitHub
IntroductionReactMorphingLine, Fill and DuoSVGAccessibilityDesignRoadmapChangelog
Get started
  • Introduction
Guides
  • React
  • Morphing
  • Line, Fill and Duo
  • SVG
  • Accessibility
  • Design
Project
  • Roadmap
  • Changelog

Accessibility

Previous: SVGNext: Design

Labelling Nubo icons for screen readers.

Most icons sit next to text that already says what they mean, so Nubo hides them from screen readers by default: every icon renders with aria-hidden="true".

Decorative icons#

Next to a visible label, do nothing. The label is what gets read.

<button>
  <TrashIcon />
  Delete
</button>

Icon-only buttons#

When the icon is the only thing in a control, label the control, not the icon:

<button aria-label="Delete">
  <TrashIcon />
</button>

The button is what gets focused and announced, so that's where the name belongs.

Icons that carry meaning#

When an icon stands on its own and says something, such as a status in a table, give it a title or an aria-label. The icon then renders with role="img" and is announced.

<CircleCheckIcon title="Verified" />

Don't rely on the icon alone#

  • Pair status icons with text or a tooltip. Colors and shapes mean different things to different people.
  • Keep icons at least 16px, and give icon-only buttons a hit area of at least 24px, or 44px on touch screens.
  • Make sure the icon color has at least 3:1 contrast against its background. Duo's tint is decoration on top of that and doesn't need to meet it.

Right-to-left layouts#

Icons that point a direction, such as arrows, chevrons, undo and sign-out, should be mirrored in right-to-left layouts. Icons like clocks, checkmarks and media controls stay as they are.

In React, every icon that should mirror has the class nubo-mirror. Add one rule to your CSS and they all flip wherever the text runs right to left:

.nubo-mirror:dir(rtl) {
  scale: -1 1;
}

To override an icon, pass mirrored. mirrored={false} keeps it as drawn in every direction, for an arrow that means a fixed side of the screen. mirrored on its own always flips it.

MorphIcon needs no CSS: it reads the text direction itself and morphs to the mirrored icon, so arrow-right points left.

With plain SVG, icons.json in @nubo-icons/svg marks each icon's rtl as mirror or none.

SVGDesign

On this page

  • Decorative icons
  • Icon-only buttons
  • Icons that carry meaning
  • Don't rely on the icon alone
  • Right-to-left layouts
Edit this pageBack to top