QrCode

Data Display
stable

SSR-safe SVG QR code renderer with configurable error correction level, quiet zone, module corner radius, optional title, and a centred icon/image overlay. Accepts any text or URL via the value prop.

Preview

Rendering the live preview…

default

Rendering the live preview…

with icon

Rendering the live preview…

card

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamQrCodeSchematic of the QrCode component with 5 numbered parts. origam-qr-code__title ⬛ origam-qr-code__svg-host ◆ origam-qr-code__center (icon/image/#center slot) 1 2 3 4 5
Anatomy of <origam-qr-code> — 5 parts: wrapper root, optional title, SVG host, inline SVG matrix, and the centred overlay zone (#center slot).
1.origam-qr-code
Root wrapper element. Has role="img" and aria-label. Applies wrapper-level color, bgColor, rounded, border, elevation, size, padding, margin.
2.origam-qr-code__title
Optional heading rendered above the SVG. Only present when the title prop is set.
3.origam-qr-code__svg-host
Container div that hosts the inline SVG element and the center overlay. Manages the relative positioning context.
4inline SVG (matrix)
The QR matrix rendered as an inline SVG by qrcode-generator. Module color and corner radius are applied here from qrCodeProps.
5.origam-qr-code__center
Absolutely centered overlay zone. Renders the icon (origam-qr-code__center-icon), image (origam-qr-code__center-avatar), or #center slot. aria-hidden="true".

API

Props

All props accepted by this component, with their type, default value and description.

value
required
string
—
Text or URL encoded into the QR matrix. UTF-8 is supported via qrcode-generator Byte mode.
title
string
Optional heading rendered above the QR matrix inside the wrapper.
qrCodeProps
IQrCodeOptions
Per-matrix overrides applied inside the SVG (not on the wrapper). Accepts color, bgColor, rounded to style modules independently from the wrapper.
errorCorrectionLevel
TQrCodeErrorCorrectionLevel
'M'
Reed-Solomon redundancy level: L (7%), M (15%), Q (25%), H (30%). Higher levels survive more damage or logo overlay, at the cost of denser modules.
quietZone
number
4
Number of modules reserved as quiet-zone padding around the matrix. ISO mandates ≥ 4.
icon
Optional centred icon overlay rendered via OrigamIcon on top of the matrix. Coexists with image; the #center slot overrides both.
image
string | ISrcObject
Optional centred image overlay. Accepts a raw URL or ISrcObject (src, srcset, alt…). Rendered as an OrigamAvatar.
ariaLabel
string
"QR code for {value}"
Accessible label for the QR code (aria-label on the root element). Falls back to "QR code for {value}" when omitted.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
Root HTML tag for the wrapper element.
color
Wrapper text color. The SVG modules inherit this via fill="currentColor" unless qrCodeProps.color overrides.
bgColor
Wrapper background color.
Wrapper border-radius. Use qrCodeProps.rounded to apply per-module corner rounding to the QR matrix.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border to the wrapper element.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
elevation
TElevation
Box-shadow elevation token applied to the wrapper.
size
'default'
Width and height of the wrapper element. Token sizes: sm=120px, md=240px, lg=480px.
padding
boolean | number | string
Inner padding of the wrapper around the QR SVG.
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
Outer margin of the wrapper element.
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string

API

Slots

Content slots exposed by this component.

#center
Replaces the default icon/image overlay at the center of the QR matrix. Receives the resolved size of the central reserved square in module units. When provided, both icon and image props are ignored.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Default module (dark square) fill color.
Default quiet-zone and SVG background color.
Wrapper width/height for size="small".
Wrapper width/height for size="default" (medium).
Wrapper width/height for size="large".
Per-module corner radius in module units. 0 = square, 0.5 = circle.
Pixel padding of the opaque backdrop drawn around the logo overlay.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

ARIA roles

img

Notes

  • The root element has role="img" and aria-label. When ariaLabel is not set, it falls back to "QR code for {value}". This ensures screen readers announce the purpose without exposing the raw URL twice.
  • The center overlay (icon, image, or #center slot) is marked aria-hidden="true" since it is purely decorative — the aria-label on the root already conveys the full meaning.
  • When using a logo overlay, use errorCorrectionLevel="H" (30% redundancy). Lower levels may make the code unscannable when modules are occluded by the overlay.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Basic QR code

vue

With centred icon overlay

vue

Custom module style

vue