Componentticket-stub1 KB gzipZero dependencies

Ticket Validator

Ticket validator device with blinking green/red result light.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add ticket-validator

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { TicketValidator } from "@/components/ui/ticket-validator"; <TicketValidator />

Source code

ticket-validator.tsx + 1 helper

Zero 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

PropTypeDescription
onValidate(code: string) => voidCallback invoked on validate.
resultboolean | nullnull: pending, true: valid, false: invalid