QrCode
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…
defaultRendering the live preview…
with iconRendering the live preview…
cardStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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.
- valuerequiredstring—
- Text or URL encoded into the QR matrix. UTF-8 is supported via qrcode-generator Byte mode.
- titlestring
- Optional heading rendered above the QR matrix inside the wrapper.
- qrCodePropsIQrCodeOptions
- Per-matrix overrides applied inside the SVG (not on the wrapper). Accepts color, bgColor, rounded to style modules independently from the wrapper.
- errorCorrectionLevelTQrCodeErrorCorrectionLevel'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.
- quietZonenumber4
- 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.
- imagestring | ISrcObject
- Optional centred image overlay. Accepts a raw URL or ISrcObject (src, srcset, alt…). Rendered as an OrigamAvatar.
- ariaLabelstring"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.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'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.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border to the wrapper element.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- elevationTElevation
- Box-shadow elevation token applied to the wrapper.
- Width and height of the wrapper element. Token sizes: sm=120px, md=240px, lg=480px.
- paddingboolean | number | string
- Inner padding of the wrapper around the QR SVG.
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- marginboolean | number | string
- Outer margin of the wrapper element.
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | 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
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
With centred icon overlay
Custom module style