How to build an accessible QrCode in React

Rendered as role="img" with an accessible label so screen-reader users know a QR code is present; the underlying link should also be available as text since a QR code is not operable by assistive tech

When to use a QrCode

When not to use it

Accessibility

Role img, verified at WCAG 2.2-AA.

Common mistakes

Avoid: <QrCode value={veryLongString} />

Prefer: <QrCode value="https://cascivo.dev/s/abc" />

Long payloads force a dense, hard-to-scan code; encode a short URL that redirects instead

Example

<QrCode value="https://cascivo.dev" />

See the full QrCode reference →