QR Code
Client-rendered QR code drawn as inline SVG, with square or rounded modules. The encoder loads lazily on mount, so nothing ships to the server render. The paired useQRCode composable downloads the same code as SVG or an image.
Default
Pass any string to url. The code fills its container, so give it a width. Click it to switch between square and rounded modules, a choice that persists and applies to every QR code in the app.
Pinned variant
Set variant to lock the module shape. A pinned code ignores the shared style and drops the click-to-toggle affordance.
Colors
fgColor and bgColor accept any CSS color, including custom properties. The background is transparent by default so the code inherits whatever surface it sits on.
Error correction
Higher levels survive more damage at the cost of denser modules. Use Q or H when the code is printed, overlaid, or scanned in poor light.
Download
useQRCode regenerates the code off-screen at a larger size and saves it. downloadSVG keeps it vector, downloadJPG rasterizes it on a canvas. Both resolve CSS variables to real colors first, so the saved file never renders blank.
API Reference
QRCode
useQRCode
useQRCodeStyle
Accessibility
Keyboard shortcuts and ARIA behavior.
- A QR code carries no text alternative on its own. Print the encoded value, or a plain link to it, next to the code so it stays usable without a camera.
- Set toggleable to false when the code sits inside a link, a card, or any other clickable surface, so a scan attempt is not read as a style change.
- Keep enough contrast between fgColor and the surface behind it. Scanners need roughly the same contrast people do.