Skip to content

QR code

A QR code for one absolute address, drawn as an SVG, named for what it opens.

<figure class="cap-qr" id="qr-default">
  <svg class="cap-qr-code" viewBox="0 0 33 33" role="img" aria-label="QR code for https://example.com/guides/getting-started" shape-rendering="crispEdges"><rect width="33" height="33" fill="#ffffff" /><path d="M2 2h7v1h-7zM11 2h4v1h-4zM17 2h1v1h-1zM19 2h3v1h-3zM24 2h7v1h-7zM2 3h1v1h-1zM8 3h1v1h-1zM16 3h2v1h-2zM19 3h1v1h-1zM22 3h1v1h-1zM24 3h1v1h-1zM30 3h1v1h-1zM2 4h1v1h-1zM4 4h3v1h-3zM8 4h1v1h-1zM14 4h1v1h-1zM17 4h3v1h-3zM22 4h1v1h-1zM24 4h1v1h-1zM26 4h3v1h-3zM30 4h1v1h-1zM2 5h1v1h-1zM4 5h3v1h-3zM8 5h1v1h-1zM11 5h1v1h-1zM16 5h3v1h-3zM20 5h3v1h-3zM24 5h1v1h-1zM26 5h3v1h-3zM30 5h1v1h-1zM2 6h1v1h-1zM4 6h3v1h-3zM8 6h1v1h-1zM12 6h2v1h-2zM15 6h4v1h-4zM20 6h1v1h-1zM24 6h1v1h-1zM26 6h3v1h-3zM30 6h1v1h-1zM2 7h1v1h-1zM8 7h1v1h-1zM10 7h1v1h-1zM13 7h1v1h-1zM15 7h4v1h-4zM20 7h2v1h-2zM24 7h1v1h-1zM30 7h1v1h-1zM2 8h7v1h-7zM10 8h1v1h-1zM12 8h1v1h-1zM14 8h1v1h-1zM16 8h1v1h-1zM18 8h1v1h-1zM20 8h1v1h-1zM22 8h1v1h-1zM24 8h7v1h-7zM12 9h2v1h-2zM16 9h2v1h-2zM19 9h1v1h-1zM21 9h2v1h-2zM2 10h1v1h-1zM5 10h1v1h-1zM7 10h2v1h-2zM10 10h9v1h-9zM23 10h1v1h-1zM25 10h1v1h-1zM2 11h1v1h-1zM6 11h1v1h-1zM9 11h1v1h-1zM11 11h1v1h-1zM15 11h2v1h-2zM19 11h1v1h-1zM22 11h1v1h-1zM24 11h1v1h-1zM27 11h1v1h-1zM30 11h1v1h-1zM3 12h6v1h-6zM12 12h1v1h-1zM14 12h1v1h-1zM16 12h1v1h-1zM18 12h1v1h-1zM21 12h1v1h-1zM25 12h5v1h-5zM2 13h2v1h-2zM5 13h2v1h-2zM12 13h5v1h-5zM18 13h1v1h-1zM20 13h1v1h-1zM23 13h1v1h-1zM25 13h2v1h-2zM28 13h2v1h-2zM2 14h1v1h-1zM6 14h3v1h-3zM10 14h2v1h-2zM15 14h1v1h-1zM18 14h2v1h-2zM21 14h4v1h-4zM27 14h1v1h-1zM29 14h2v1h-2zM2 15h1v1h-1zM6 15h1v1h-1zM11 15h4v1h-4zM16 15h1v1h-1zM19 15h3v1h-3zM23 15h1v1h-1zM4 16h2v1h-2zM7 16h2v1h-2zM11 16h1v1h-1zM14 16h1v1h-1zM16 16h1v1h-1zM18 16h1v1h-1zM20 16h1v1h-1zM22 16h2v1h-2zM26 16h5v1h-5zM3 17h1v1h-1zM6 17h2v1h-2zM10 17h3v1h-3zM15 17h1v1h-1zM18 17h6v1h-6zM25 17h1v1h-1zM27 17h1v1h-1zM29 17h1v1h-1zM2 18h3v1h-3zM7 18h2v1h-2zM11 18h1v1h-1zM13 18h2v1h-2zM17 18h1v1h-1zM19 18h2v1h-2zM22 18h2v1h-2zM29 18h1v1h-1zM3 19h4v1h-4zM9 19h1v1h-1zM11 19h2v1h-2zM14 19h3v1h-3zM18 19h2v1h-2zM23 19h3v1h-3zM27 19h1v1h-1zM30 19h1v1h-1zM2 20h1v1h-1zM6 20h1v1h-1zM8 20h2v1h-2zM11 20h1v1h-1zM13 20h1v1h-1zM19 20h1v1h-1zM23 20h2v1h-2zM26 20h1v1h-1zM29 20h2v1h-2zM6 21h1v1h-1zM9 21h1v1h-1zM16 21h7v1h-7zM24 21h3v1h-3zM29 21h2v1h-2zM2 22h1v1h-1zM4 22h1v1h-1zM6 22h1v1h-1zM8 22h1v1h-1zM10 22h1v1h-1zM13 22h6v1h-6zM21 22h6v1h-6zM28 22h1v1h-1zM10 23h2v1h-2zM13 23h3v1h-3zM18 23h2v1h-2zM21 23h2v1h-2zM26 23h1v1h-1zM28 23h3v1h-3zM2 24h7v1h-7zM11 24h1v1h-1zM13 24h3v1h-3zM19 24h1v1h-1zM22 24h1v1h-1zM24 24h1v1h-1zM26 24h1v1h-1zM29 24h1v1h-1zM2 25h1v1h-1zM8 25h1v1h-1zM10 25h1v1h-1zM12 25h2v1h-2zM15 25h4v1h-4zM20 25h1v1h-1zM22 25h1v1h-1zM26 25h5v1h-5zM2 26h1v1h-1zM4 26h3v1h-3zM8 26h1v1h-1zM11 26h1v1h-1zM14 26h1v1h-1zM16 26h1v1h-1zM19 26h1v1h-1zM22 26h5v1h-5zM2 27h1v1h-1zM4 27h3v1h-3zM8 27h1v1h-1zM10 27h1v1h-1zM12 27h1v1h-1zM14 27h2v1h-2zM19 27h1v1h-1zM21 27h4v1h-4zM26 27h4v1h-4zM2 28h1v1h-1zM4 28h3v1h-3zM8 28h1v1h-1zM12 28h3v1h-3zM16 28h1v1h-1zM18 28h2v1h-2zM26 28h3v1h-3zM30 28h1v1h-1zM2 29h1v1h-1zM8 29h1v1h-1zM12 29h1v1h-1zM16 29h7v1h-7zM24 29h1v1h-1zM29 29h1v1h-1zM2 30h7v1h-7zM10 30h4v1h-4zM15 30h2v1h-2zM18 30h2v1h-2zM22 30h1v1h-1zM24 30h4v1h-4zM29 30h1v1h-1z" fill="#000000" /></svg>
  <figcaption class="cap-qr-caption">Scan to open this guide online.<span class="cap-qr-url">https://example.com/guides/getting-started</span></figcaption>
</figure>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/qr.css";
import { qrPath, qrSize, qrLabel } from "capsomer/behavior/qr";

Usage

<figure class="cap-qr">
  <svg class="cap-qr-code" viewBox="0 0 33 33" role="img" aria-label="QR code for https://example.com/guides/getting-started" shape-rendering="crispEdges">
    <rect width="33" height="33" fill="#ffffff" />
    <path d="M2 2h7v1h-7z…" fill="#000000" />
  </svg>
  <figcaption class="cap-qr-caption">Scan to open this guide online.<span class="cap-qr-url">https://example.com/guides/getting-started</span></figcaption>
</figure>
import { encode } from "uqr";
import { Qr } from "capsomer/react/qr";

<Qr url={address} modules={encode(address, { ecc: "M", border: 0 }).data} caption="Scan to open this version online." />

Examples

Large, with the address alone

<figure class="cap-qr" id="qr-large" data-size="lg">
  <svg class="cap-qr-code" viewBox="0 0 33 33" role="img" aria-label="QR code, large, for https://example.com/guides/getting-started" shape-rendering="crispEdges"><rect width="33" height="33" fill="#ffffff" /><path d="M2 2h7v1h-7zM11 2h4v1h-4zM17 2h1v1h-1zM19 2h3v1h-3zM24 2h7v1h-7zM2 3h1v1h-1zM8 3h1v1h-1zM16 3h2v1h-2zM19 3h1v1h-1zM22 3h1v1h-1zM24 3h1v1h-1zM30 3h1v1h-1zM2 4h1v1h-1zM4 4h3v1h-3zM8 4h1v1h-1zM14 4h1v1h-1zM17 4h3v1h-3zM22 4h1v1h-1zM24 4h1v1h-1zM26 4h3v1h-3zM30 4h1v1h-1zM2 5h1v1h-1zM4 5h3v1h-3zM8 5h1v1h-1zM11 5h1v1h-1zM16 5h3v1h-3zM20 5h3v1h-3zM24 5h1v1h-1zM26 5h3v1h-3zM30 5h1v1h-1zM2 6h1v1h-1zM4 6h3v1h-3zM8 6h1v1h-1zM12 6h2v1h-2zM15 6h4v1h-4zM20 6h1v1h-1zM24 6h1v1h-1zM26 6h3v1h-3zM30 6h1v1h-1zM2 7h1v1h-1zM8 7h1v1h-1zM10 7h1v1h-1zM13 7h1v1h-1zM15 7h4v1h-4zM20 7h2v1h-2zM24 7h1v1h-1zM30 7h1v1h-1zM2 8h7v1h-7zM10 8h1v1h-1zM12 8h1v1h-1zM14 8h1v1h-1zM16 8h1v1h-1zM18 8h1v1h-1zM20 8h1v1h-1zM22 8h1v1h-1zM24 8h7v1h-7zM12 9h2v1h-2zM16 9h2v1h-2zM19 9h1v1h-1zM21 9h2v1h-2zM2 10h1v1h-1zM5 10h1v1h-1zM7 10h2v1h-2zM10 10h9v1h-9zM23 10h1v1h-1zM25 10h1v1h-1zM2 11h1v1h-1zM6 11h1v1h-1zM9 11h1v1h-1zM11 11h1v1h-1zM15 11h2v1h-2zM19 11h1v1h-1zM22 11h1v1h-1zM24 11h1v1h-1zM27 11h1v1h-1zM30 11h1v1h-1zM3 12h6v1h-6zM12 12h1v1h-1zM14 12h1v1h-1zM16 12h1v1h-1zM18 12h1v1h-1zM21 12h1v1h-1zM25 12h5v1h-5zM2 13h2v1h-2zM5 13h2v1h-2zM12 13h5v1h-5zM18 13h1v1h-1zM20 13h1v1h-1zM23 13h1v1h-1zM25 13h2v1h-2zM28 13h2v1h-2zM2 14h1v1h-1zM6 14h3v1h-3zM10 14h2v1h-2zM15 14h1v1h-1zM18 14h2v1h-2zM21 14h4v1h-4zM27 14h1v1h-1zM29 14h2v1h-2zM2 15h1v1h-1zM6 15h1v1h-1zM11 15h4v1h-4zM16 15h1v1h-1zM19 15h3v1h-3zM23 15h1v1h-1zM4 16h2v1h-2zM7 16h2v1h-2zM11 16h1v1h-1zM14 16h1v1h-1zM16 16h1v1h-1zM18 16h1v1h-1zM20 16h1v1h-1zM22 16h2v1h-2zM26 16h5v1h-5zM3 17h1v1h-1zM6 17h2v1h-2zM10 17h3v1h-3zM15 17h1v1h-1zM18 17h6v1h-6zM25 17h1v1h-1zM27 17h1v1h-1zM29 17h1v1h-1zM2 18h3v1h-3zM7 18h2v1h-2zM11 18h1v1h-1zM13 18h2v1h-2zM17 18h1v1h-1zM19 18h2v1h-2zM22 18h2v1h-2zM29 18h1v1h-1zM3 19h4v1h-4zM9 19h1v1h-1zM11 19h2v1h-2zM14 19h3v1h-3zM18 19h2v1h-2zM23 19h3v1h-3zM27 19h1v1h-1zM30 19h1v1h-1zM2 20h1v1h-1zM6 20h1v1h-1zM8 20h2v1h-2zM11 20h1v1h-1zM13 20h1v1h-1zM19 20h1v1h-1zM23 20h2v1h-2zM26 20h1v1h-1zM29 20h2v1h-2zM6 21h1v1h-1zM9 21h1v1h-1zM16 21h7v1h-7zM24 21h3v1h-3zM29 21h2v1h-2zM2 22h1v1h-1zM4 22h1v1h-1zM6 22h1v1h-1zM8 22h1v1h-1zM10 22h1v1h-1zM13 22h6v1h-6zM21 22h6v1h-6zM28 22h1v1h-1zM10 23h2v1h-2zM13 23h3v1h-3zM18 23h2v1h-2zM21 23h2v1h-2zM26 23h1v1h-1zM28 23h3v1h-3zM2 24h7v1h-7zM11 24h1v1h-1zM13 24h3v1h-3zM19 24h1v1h-1zM22 24h1v1h-1zM24 24h1v1h-1zM26 24h1v1h-1zM29 24h1v1h-1zM2 25h1v1h-1zM8 25h1v1h-1zM10 25h1v1h-1zM12 25h2v1h-2zM15 25h4v1h-4zM20 25h1v1h-1zM22 25h1v1h-1zM26 25h5v1h-5zM2 26h1v1h-1zM4 26h3v1h-3zM8 26h1v1h-1zM11 26h1v1h-1zM14 26h1v1h-1zM16 26h1v1h-1zM19 26h1v1h-1zM22 26h5v1h-5zM2 27h1v1h-1zM4 27h3v1h-3zM8 27h1v1h-1zM10 27h1v1h-1zM12 27h1v1h-1zM14 27h2v1h-2zM19 27h1v1h-1zM21 27h4v1h-4zM26 27h4v1h-4zM2 28h1v1h-1zM4 28h3v1h-3zM8 28h1v1h-1zM12 28h3v1h-3zM16 28h1v1h-1zM18 28h2v1h-2zM26 28h3v1h-3zM30 28h1v1h-1zM2 29h1v1h-1zM8 29h1v1h-1zM12 29h1v1h-1zM16 29h7v1h-7zM24 29h1v1h-1zM29 29h1v1h-1zM2 30h7v1h-7zM10 30h4v1h-4zM15 30h2v1h-2zM18 30h2v1h-2zM22 30h1v1h-1zM24 30h4v1h-4zM29 30h1v1h-1z" fill="#000000" /></svg>
  <figcaption class="cap-qr-caption"><span class="cap-qr-url">https://example.com/guides/getting-started</span></figcaption>
</figure>

API reference

Qr

PropTypeRequiredDoes
urlstringYesThe address the code opens: absolute http(s).
modulesReadonlyArray<ReadonlyArray<boolean>>YesThe encoder's module matrix for url, without its border (uqr: encode(url, { ecc: "M", border: 0 }).data).
quietnumberThe quiet zone in modules. Default 2.
captionReactNodeWhat scanning it is for ("Scan to open this version online."), above the address.
showUrlbooleanShow the address as text under the code. Default true: a reader with no scanner can type it.
labelstringThe code's name. Default: "QR code for {url}".
size"lg""lg": 10rem across, for a poster or a slide (data-size="lg"); default 6.5rem.

Functions

FunctionSignatureDoes
qrPath(modules: readonly (readonly boolean[])[], quiet?: number): stringThe QR code: an SVG drawn from the module matrix a QR encoder returns, so Capsomer carries no encoder of its own. The site encodes (dustinedwards.info uses uqr: encode(url, { ecc: "M", border: 0 }).data) and passes the matrix; this draws it as one path, dark modules on a white ground with a quiet zone, whatever the reader's theme, because a scanner reads contrast. From dustinedwards.info (app/kb/procedures/qr.mjs and the procedure sheet's figure). The matrix as one path, each row's runs of dark modules as rectangles, offset by the quiet zone.
qrSize(modules: readonly (readonly boolean[])[], quiet?: number): numberThe side of the drawing in modules, quiet zone included.
qrLabel(url: string): stringThe code's name: what scanning it opens.
checkQrUrl(url: string): stringRefuses anything but an absolute http(s) address: a code a reader scans opens a page.

Parts and data attributes

ClassIs
.cap-qrthe root
.cap-qr-captiona part
.cap-qr-codea part
.cap-qr-urla part
AttributeValues
data-sizelg

Accessibility

KeyDoes
TabPasses it: the code is an image, not a control
  • The SVG is role="img" named "QR code for {url}"; the figure's caption says what it is for and gives the address.
  • Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.