ComponentStandalone

QR Code

Renders a QR code on a canvas. Optional center icon overlay. Encoding is handled by Project Nayuki's QR Code generator library (MIT) vendored inline — no runtime dependency.

Installation

import { WrQr } from 'ngwr/qr';

@Component({ imports: [WrQr] })
export class MyComponent {}

Basic usage

<wr-qr value="https://ngwr.dev" />

Sized, colored, high error correction

Use level='H' when you plan to overlay anything in the center.

<wr-qr value="ngwr" [size]="240" level="H" color="#3969e2" />

Center icon

iconUrl overlays an image in the middle; pair it with level='H' so the covered modules stay recoverable.

<wr-qr value="https://ngwr.dev" [size]="180" level="H" iconUrl="/icon.svg" [iconSize]="40" />

Interactive

<wr-qr [value]="text()" [size]="200" />

API

NameDescriptionTypeDefault
valuerequiredText or URL to encode. Required.string
levelError correction level. Use 'H' if you overlay an icon.WrQrErrorLevel'M'
sizeSide length of the rendered canvas, in pixels.number160
paddingOuter quiet-zone padding in pixels.number10
colorModule (dot) color.string'#000000'
bgColorBackground color of the canvas + host.string'#ffffff'
iconUrlOptional image URL or data URL to overlay in the center.string | nullnull
iconSizeCenter icon size in logical pixels.number42
ariaLabelAccessible name. A QR code is content — it usually encodes a URL — and a <canvas> carries no implicit role and no text alternative, so without a name it is nothing at all to a screen reader. Say what the code is FOR when you can. Falls back to qr.label.string | nullnull