QR Share

QR Share is a copy-paste React component that stops qr code opens the wrong page before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/qr-share
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsQR code opens the wrong page

Was this component page useful?

How do I install QR Share?

pnpm dlx shadcn@latest add @bollard/qr-share

The files land in your project. They're yours to edit.

How do I use QR Share in React?

qr-share-usage.tsx
import { QrShare } from "@/components/ui/qr-share"

<QrShare
  defaultValue="http://localhost:3000/rsvp/launch-2026?utm_source=print&utm_medium=qr&utm_campaign=launch-week-table-cards&utm_content=table-12"
  publicOrigin="https://acme.events"
/>

What input mistakes does QR Share catch?

  • localhost or staging URLs, with a swap to publicOrigin
  • http instead of https
  • Invisible characters in the URL, marked with their code point
  • Links long enough to make a dense, hard-to-scan code
  • Encoder output that doesn't decode back to the URL

What props does QR Share accept?

QrShare props
PropTypeDefault
value

Controlled URL.

string—
defaultValue

Initial URL when uncontrolled.

string""
onValueChange

Called with the new URL when a one-tap fix is used.

(value: string) => void—
publicOrigin

The live origin (e.g. "https://acme.com") offered in place of localhost or staging.

string—
size

Rendered width of the code in px, quiet zone included.

number176
denseVersion

Version from which a code counts as dense (7 = 45×45 dots).

number7
messages

Overrides for the issue messages in `QR_MESSAGES`.

Partial<typeof QR_MESSAGES>—
verifiedText

Templates: `{count}` (characters), `{modules}` and `{print}` are filled in.

string"Scans back as exactly these {count} characters · {module…
mismatchText

Shown when the drawn code doesn't decode back to the URL.

string"This code doesn't scan back as the link above. Don't sha…

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is QR Share accessible?

  • QR SVG is role=img with an aria-label naming the URL
  • Issues are a polite live region; a decode mismatch uses role=alert
  • Draw animation is skipped under reduced motion

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Byte mode and error correction M only; no logos or other ECC levels
  • Self-check proves the matrix, not that printers or screens reproduce it well

What expensive mistakes does QR Share stop?

QR code opens the wrong page

Also known as

qr code · qr generator · share · url · menu qr · poster · upi qr · print

Field type

What dependencies does QR Share require?

QR Share facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameQR Share
Registry identifier@bollard/qr-share
Install commandnpx shadcn@latest add @bollard/qr-share
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about QR Share

What form validation mistake does QR Share catch?

QR Share prevents qR code opens the wrong page. Reads the exact URL back under a QR code and re-decodes what it drew, so a shared code doesn't open the wrong page. Catches: localhost or staging URLs, with a swap to publicOrigin, http instead of https, Invisible characters in the URL, marked with their code point, Links long enough to make a dense, hard-to-scan code, Encoder output that doesn't decode back to the URL. Limitation: validate qr-share schemas on backend.

How do I install qr-share with shadcn?

Run `npx shadcn@latest add @bollard/qr-share`. Sources added: registry/default/qr-share/qr-encode.ts, registry/default/qr-share/qr-share.tsx. Package requirements: lucide-react.

What props customize QR Share?

QR Share accepts `value`, `defaultValue`, `onValueChange`, `publicOrigin`, `size`. Configures qr code, qr generator, share behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of qr-share?

Byte mode and error correction M only; no logos or other ECC levels. Self-check proves the matrix, not that printers or screens reproduce it well Server requirement: backend verification for qr-share.

How does QR Share meet accessibility guidelines?

QR SVG is role=img with an aria-label naming the URL. Issues are a polite live region; a decode mismatch uses role=alert. Draw animation is skipped under reduced motion. Minimizes errors: qr code wrong link, qr code localhost.

Which components pair with QR Share?