On this page

Accessibility

Some people never see an icon; others need it large and clear. Give each icon a name or hide it, and make clickable icons easy to hit.

An icon is either decorative and hidden, or it has a name. A clickable icon is always inside a button or a link of at least 24 × 24.

Check Rule WCAG 2.2
Decorative icon Hidden with aria-hidden="true" 1.1.1
Icon-only button or link Has a name (aria-label) and a matching tooltip 1.1.1, 2.5.3, 4.1.2
Icon that carries meaning 3:1 contrast or more with its background 1.4.11
Status Written in words, never icon or colour alone 1.4.1
Target 24 × 24 or more; 32 × 32 icon buttons in products 2.5.8

Decorative icons

When text sits next to the icon, the icon is decorative. Hide it, so screen readers read the label once.

Lucide does this for you: an icon with no aria-label, aria-labelledby, role or title gets aria-hidden="true". Don’t add a label to an icon that already has text next to it.

Do
<button><RefreshCw /> Sync now</button>
Read as: “Sync now, button”

Decorative icon hidden; the label is read once.

Don’t
<button><svg role="img" aria-label="refresh-cw"> Sync now</button>
Read as: “refresh-cw, Sync now, button”

The icon is read too: “refresh-cw, Sync now”.

Icon-only buttons

Name the button, not the icon. Put the name on the <button> or <a> with aria-label. The icon inside stays hidden.

  • The name says what happens: “Delete store”, not “Trash” or “Icon”.
  • Add a tooltip with the same words, on hover and on keyboard focus. The tooltip must start with the button’s name, so speech input users can say what they see (WCAG 2.5.3).
  • Use an icon-only button only for well-known actions. See Icon and label.
<button type="button" aria-label="Settings">
  <svg aria-hidden="true">…</svg>
</button>
Do
Settings

Icon-only button with a name and a matching tooltip.

Don’t

Icon-only button with no name and no tooltip.

Meaningful icons on their own

When an icon is the only sign of something, such as a status icon in a narrow table column, give the icon itself a name: role="img" and aria-label="Failed". Prefer writing the status in words.

Contrast

Icons that carry meaning need 3:1 against their background (WCAG 1.4.11). Every color.icon.* token meets 3:1 on the backgrounds it is paired with, in light and dark; the build checks it. Decorative icons and icons in disabled controls have no minimum.

See every pair in colour accessibility.

Target size

Anything you can click is at least 24 × 24 (WCAG 2.5.8). In Beehexa products, icon buttons are 32 × 32 with a 16 px icon. The icon is never the only thing to click.

24
24 × 24 minimum for anything you can click (WCAG 2.5.8). Use it only where space is tight, such as a tag’s remove button.
32
32 × 32 in products. Every icon button is 32 × 32 with a 16 px icon, or 20 px in a toolbar.
Do

A 32 × 32 button around a 16 px icon.

Don’t

The 16 px icon is the only thing to click.

Keyboard and focus

  • The button or link gets focus, never the icon. Don’t add tabindex to an <svg>.
  • The focus ring goes around the whole 32 × 32 button.
  • A tooltip opens on focus as well as hover, and closes with Escape.

Checklist

  • Every icon next to text is hidden from screen readers.
  • Every icon-only button has a name and a tooltip with the same words.
  • No status is shown by an icon or colour alone.
  • Meaningful icons reach 3:1; the token already does if you use the right one.
  • Every clickable icon sits in a target of 24 × 24 or more.