Components · Data Display
QR Code
AlphaAdded v10.9.0
A QR code as an SVG, always dark on light so it scans in every theme, with its value shown as text.
import { QRCode } from '@nexub/react';Playground
Props
<QRCode value="https://example.com/h/4729" />Examples
Default
With a logo and a caption
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| valuerequired | string | — | The text to encode, usually a URL. Up to 2,953 bytes of UTF-8 (1,273 with a logo). |
| size | string | number | 160 | Width of the code: pixels, or any CSS length. It never grows past its container. |
| ecc | 'L' | 'M' | 'Q' | 'H' | 'M', or 'H' with a `logo` | Error correction: how much of the code may be damaged or covered (7%, 15%, 25%, 30%). |
| logo | React.ReactNode | — | A mark in the centre, on a light tile a fifth of the width. |
| quietZone | number | 4 | Light margin around the code, in modules. Readers need 4. |
| label | string | 'QR code for <value>' | Text alternative of the image. The default is English: pass your own to translate it. |
| caption | React.ReactNode | — | The text under the code, so it can be read and typed without a camera. false hides it. |
On iOS & Android: QRCode
@nexub/react-nativeAlpha
import { QRCode } from '@nexub/react-native';
<QRCode value="https://example.com/h/4729" size={200} />Web vs mobile
Same tokens and prop names. Where the platforms differ:
| Web | iOS & Android | |
|---|---|---|
| Drawing | An inline SVG; size takes pixels or any CSS length. | react-native-svg; size is in points. |
| Colours | Dark on light in every theme (the light roles are pinned). | The same: the light scheme’s colours, also in dark mode. |
| Reading one | Not in the browser. | QRScanner reads codes with the camera. |
Interactive preview of @nexub/react-native rendered for the web. Native chrome (switches, pickers, Liquid Glass) looks like the platform on a device.
On device

iPhone (iOS simulator)

Pixel (Android emulator)
Screenshots from the latest CI run of the showcase app; the live frame renders the same code for the web.
QRCode props
| Prop | Type | Default | Description |
|---|---|---|---|
| valuerequired | string | — | The text to encode, usually a URL. Up to 2,953 bytes of UTF-8 (1,273 with a logo). |
| size | number | 160 | Width of the code in points. |
| ecc | QRErrorCorrection | 'M', or 'H' with a `logo` | Error correction: how much of the code may be damaged or covered. |
| logo | React.ReactNode | — | A mark in the centre, on a light tile a fifth of the width. Raises the default ecc to 'H'. |
| quietZone | number | 4 | Light margin around the code, in modules. Readers need 4. |
| label | string | "QR code for <value>" | Text alternative of the image. |
| caption | React.ReactNode | false | — | The text under the code. Defaults to the value, so it can be read and typed without a camera. false hides it. |