Pro
Qr code
A QR code drawn as one crisp SVG path, encoded in the file with no dependency and no request. It stays dark on a white plate in both themes, keeps the quiet zone scanners need, and says what it is for to assistive technology.
pnpm dlx shadcn@latest add @caliper/qr-codeWhen to use
Use it for
- Handing a link from screen to phone: sign-in on another device, an invoice, a ticket, a download.
- Printed or exported pages where a link cannot be clicked.
Skip it when
- As the only way to reach something; always show the link or a copy button beside it.
- Payloads longer than a short link; version 10 holds about 213 bytes at level M.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Too long says so
- Text beyond version 10 shows a short notice in the code's place instead of a code that would not scan.
Styling
- Never inverted
- Many phone scanners cannot read light modules on dark, so the plate is white in dark mode too.
Usage
- Name the purpose
labelis what a screen reader hears ("Scan to pay INV-2041"); without it the encoded text is read.
Installation
pnpm dlx shadcn@latest add @caliper/qr-code
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from QrCode and encodeQr.
import { QrCode, encodeQr } from "@/components/ui/qr-code"
The worked example comes with Pro
The 36-line example behind the preview opens here, ready to copy.
- 576 Pro parts, blocks and page templates, all with source
- $199 once, with a year of updates. What you have stays yours
- A full refund within 14 days if it is not for you
API reference
QrCode
component
Also accepts the native props of its root element and a ref.
encodeQr
component
No props of its own; it accepts the native props of its root element.
Accessibility
It exposes note and img semantics, with aria-label kept in step with state.
No custom key handling; Tab and the native activation keys do the work.
Motion
It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.
Related
- Copy buttonCopies a value and confirms what was copied, with a fallback when the clipboard is blocked.
- Share panelA panel to invite people, set access and copy a link.
- Ticket stubA ticket with a perforated stub. Checking in tears the stub off along the perforation, so used is something you can see on the ticket and not only read. The tear is the feedback; the plain text line on the ticket is the record.