Componentticket-stub1 KB gzipZero dependencies
Ticket Validator
Ticket validator device with blinking green/red result light.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add ticket-validatorOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { TicketValidator } from "@/components/ui/ticket-validator"; <TicketValidator />Source code
ticket-validator.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxticket-validator.tsx74 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface TicketValidatorProps extends React.HTMLAttributes<HTMLDivElement> { onValidate?: (code: string) => void; /** null: pending, true: valid, false: invalid */ result?: boolean | null;} /** Ticket validator device: barcode input + valid/invalid indicator light. */export function TicketValidator({ onValidate, result, className, ...props }: TicketValidatorProps) { const [code, setCode] = React.useState(""); const [internal, setInternal] = React.useState<boolean | null>(null); const state = result !== undefined ? result : internal; const submit = () => {Props
| Prop | Type | Description |
|---|---|---|
| onValidate | (code: string) => void | Callback invoked on validate. |
| result | boolean | null | null: pending, true: valid, false: invalid |