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
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add qr-readerOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { QrReader } from "@/components/ui/qr-reader"; <QrReader onScan={(data) => console.log(data.code, data.attendee)} />Source code
qr-reader.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| title | string | Header title for the turnstile scanner |
| gateId | string | Gate identifier |
| active | boolean | Whether the scanner lens is active |
| defaultScanResult | TicketScanData | null | Initial or controlled scan data |
| onScan | (data: TicketScanData) => void | Callback fired when a valid ticket is detected |
| onReset | () => void | Callback fired when scanner is reset |
| showLaser | boolean | Whether to display the animated red laser sweep line |
| showCrosshairs | boolean | Whether to display corner bracket crosshairs |
| showControls | boolean | Whether to display scanner controls |
| className | string | Additional container classes |