Accessibility
Decorative versus meaningful icons, accessible names and icon buttons.
Decorative icons
Without a title, React icons render aria-hidden="true". That's right when nearby text says the same thing.
<button>
<IconTrash /> Delete
</button>Meaningful icons
When the icon carries information on its own, give it a title. It then gets role="img" and a <title> that screen readers announce.
<IconCircleCheckFilled title="Verified" className="text-emerald-600" />Icon-only buttons
Name the button, not the icon, and keep the target at least 24×24px (44×44px on touch screens).
<button type="button" aria-label="Close dialog" className="grid size-10 place-items-center">
<IconX size={20} />
</button>Contrast
Icons that convey meaning need 3:1 contrast against their background (WCAG 1.4.11). Thin strokes read lighter than text of the same colour, so check light greys at small sizes.
Something wrong or missing?Open an issue