Componentticket-stub3.69 KB gzipZero dependencies

QR Reader

Turnstile simulated camera QR and barcode scanner viewfinder with animated laser sweep and targeting reticle.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add qr-reader

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { QrReader } from "@/components/ui/qr-reader"; <QrReader onScan={(data) => console.log(data.code, data.attendee)} />

Source code

qr-reader.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxqr-reader.tsx523 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TicketScanData {  code: string;  type: "QR-MATRIX" | "BARCODE-128";  attendee: string;  tier: string;  seat: string;  gate: string;  timestamp: string;  status: "VALID" | "ALREADY-SCANNED" | "INVALID";} export interface QrReaderProps extends React.HTMLAttributes<HTMLDivElement> {  /** Header title for the turnstile scanner */

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { QrReader } from "@/components/ui/qr-reader"; <QrReader />
PropTypeDescription
titlestringHeader title for the turnstile scanner
gateIdstringGate identifier
activebooleanWhether the scanner lens is active
defaultScanResultTicketScanData | nullInitial or controlled scan data
onScan(data: TicketScanData) => voidCallback fired when a valid ticket is detected
onReset() => voidCallback fired when scanner is reset
showLaserbooleanWhether to display the animated red laser sweep line
showCrosshairsbooleanWhether to display corner bracket crosshairs
showControlsbooleanWhether to display scanner controls
classNamestringAdditional container classes