How to build an accessible Avatar in React

role="img" with alt names the person; on image error it falls back to initials so the identity survives; the status dot carries an accessible label rather than relying on color alone

When to use a Avatar

When not to use it

Accessibility

Role img, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <Avatar src="/logo.png" /> with no alt and no fallback

Prefer: <Avatar src="/jane.jpg" alt="Jane Doe" fallback="JD" />

Without alt/fallback the identity is invisible to assistive tech and breaks on image load failure

Example

<Avatar src="/jane.jpg" alt="Jane Doe" />

See the full Avatar reference →