Skip to content

API Reference

Creates a renderer that returns an SVG string.

SVGQRCodeRenderer(options?);

Options include shared styling plus SVG accessibility attributes: alt, ariaLabel, and title.

Creates a renderer that returns terminal text.

QRCodeTextRenderer(options?);

Options include size and margin.

Normalizes styling options into complete defaults.

parseQRCodeStylingOptions(options?);

Defaults are size: 5, margin: 4, colors.colorLight: '#ffffff', and colors.colorDark: '#000000'.

The core package exports these public types:

type ParsedQRCodeStylingOptions;
type QRCodeErrorCorrectionLevel;
type QRCodeInputData;
type QRCodeMask;
type QRCodeMatrix;
type QRCodeMatrixOptions;
type QRCodeMode;
type QRCodeRenderer;
type QRCodeStylingOptions;
type QRCodeTextRendererOptions;
type QRCodeSVGRendererOptions;
type QRCodeVersion;

Creates a renderer that returns an HTMLCanvasElement.

CanvasQRCodeRenderer(options?);

Options use the shared styling shape: size, margin, colors.colorLight, and colors.colorDark.

Creates a renderer that returns an HTMLImageElement with a PNG data URL.

ImageQRCodeRenderer(options?);

Options include shared styling plus image accessibility attributes: alt, ariaLabel, and title.

Creates a renderer that triggers a PNG download in the browser and returns void.

DownloadImageQRCodeRenderer(options);

Options include renderer, an image renderer such as ImageQRCodeRenderer(options), and optional filename.

Creates a renderer that triggers an SVG download in the browser and returns void.

DownloadSVGQRCodeRenderer(options);

Options include renderer, an SVG renderer such as SVGQRCodeRenderer(options), and optional filename.

The browser package exports:

type QRCodeCanvasRendererOptions;
type QRCodeDownloadImageRendererOptions;
type QRCodeDownloadSVGRendererOptions;
type QRCodeImageRendererOptions;

Creates a renderer that returns a PNG Buffer.

PNGQRCodeRenderer(options?);

Options use the shared styling shape: size, margin, colors.colorLight, and colors.colorDark.

The Node package exports:

type QRCodePNGRendererOptions;