Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

QRCode

  • Stable
  • WCAG 2.2 evidence
  • RTL

A scannable QR code, encoded in the component with no dependency and drawn as one SVG <path> with shape-rendering: crispEdges. Presentational and deterministic: it renders in React Server Components, so the code is part of the HTML. Dark modules use qr/dark and the light background and quiet zone use qr/light. Both keep their colours in light and dark mode, and forced-colours mode leaves them alone, so the code stays dark on light and keeps the 4-module quiet zone that scanners need (never invert it). It is exposed as an image whose name is alt followed by the encoded value (WCAG 1.1.1): a QR code is not decodable by assistive technology, so the same information is given as text. Consumer duties: write alt for what the code does; show the destination as visible text next to the code where it matters (people without a camera cannot scan it); keep enough module size for the distance it is scanned from; test with a real scanner before shipping a logo.

import { QRCode } from "@nexera-ui/react";
Loading example…
8
examples
9
props
4
live controls
1
platform
6
WCAG criteria
0
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
size
errorCorrection
variant
label
Generated code
import { QRCode } from "@nexera-ui/react";

<QRCode />

Examples 7

The same examples as Storybook, rendered live. Open Code to copy one.

Framed

A brand frame with a visible label; the label is real text, the code is one image.

Loading example…

Error correction levels

The same value at the four error-correction levels: a higher level adds redundancy and needs more modules. Choose the lowest level that survives your use (a screen: L or M; a printed, scuffed sticker: Q or H).

Loading example…

Long value

A long value makes a dense code: this URL (185 bytes) needs version 10 (57 modules, 65 with the quiet zone), so each module is about 3.7 px at the largest size. Shorten the value or use a redirect where you can.

Loading example…

Right to left

Right-to-left: the symbol is never mirrored (a mirrored QR code does not scan); only the label's layout follows the direction.

Loading example…

Narrow width

Narrow container (320 px): the largest framed code is 272 px wide and a long label wraps inside the code's width.

Loading example…

Props 9

Press "Try it" on a card to load that prop into the playground.

9 props shown

value*Nexera
string

The text or URL the code carries. It is encoded on the server, in the component, with no dependency. Numbers only, capital letters and a few symbols, and everything else (UTF-8) use the densest of the standard's three modes. A longer value makes a denser code (smaller modules), so keep it short: prefer a short URL that redirects. Throws a RangeError when it is empty or too long for the largest code (2953 bytes at the lowest level).

Default –
alt*Nexera
string

Text alternative: what the code is for, for example "Check-in code for the Lahore HQ front desk" (WCAG 1.1.1). A QR code cannot be read by assistive technology, so this is required. The encoded value is appended to it automatically, so users who cannot scan still get the link or text.

Default –
valueTextNexera
string

Text that stands for value in the text alternative. Defaults to value itself. Pass the human-readable meaning only when value is opaque (a signed URL or a token); pass "" to leave the value out.

Default value
sizeNexera
"sm" | "md" | "lg"

Side of the code including the quiet zone: 96, 160 or 240 px. A code with more modules needs a larger size: aim for at least 2 px per module, or phone cameras struggle.

Default sm
errorCorrectionNexera
"L" | "M" | "Q" | "H"

How much of the code can be lost and still scan. A higher level needs more modules. with-logo covers the centre, so it defaults to H; the other variants default to M.

Default "M" ("H" with `variant="with-logo"`)
classNameNexera
string

Extra classes for the root, merged last so they win over the defaults.

Default –
variantNexera
"plain" | "with-logo" | "framed"

Presentation: plain is the code with a hairline border, with-logo puts a logo in the centre, framed sits on a brand-coloured frame with a label. A logo in the centre of the code. The code on a brand-coloured frame with a label below it.

Default plain
logoNexera
ReactNode

Only with variant="with-logo". The logo mark: an SVG or image that fills its box, in brand/on-primary. The brand-coloured frame and its light tile are drawn for you; without a mark the frame is empty. Decorative: describe the code in alt, not the logo.

Default –
labelNexera
ReactNode

Only with variant="framed". Visible caption below the code, in brand/on-primary. Wraps inside the width of the code. Translate it.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

WCAG 2.2 evidence

3 direct · 3 supporting
  • 1.1.1Non-text ContentLevel A · tested directly
  • 1.3.1Info and RelationshipsLevel A · tested directly
  • 1.3.2Meaningful SequenceLevel A · supporting test
  • 1.4.3Contrast (Minimum)Level AA · supporting test
  • 1.4.11Non-text ContrastLevel AA · supporting test
  • 4.1.2Name, Role, ValueLevel A · tested directly

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

Usage
<QRCode className="shadow-sm" />

Used in blocks

No block uses QRCode yet.

Related components