Skip to main content
U.S. flagNOT an official website of the United States government

Component Demo

All the building blocks and features of the TTB Label Editor prototype

Home

Color Tokens

Extracted from TTB.gov computed styles. Exported as `C` from TTBShell.tsx.

C.navy
#1a4480
C.darkNavy
#162e51
C.navBg
#083c6f
C.lightBlue
#005ea2
C.linkHover
#1a4480
C.white
#ffffff
C.lightGray
#f0f0f0
C.medGray
#71767a
C.darkGray
#1b1b1b
C.coolGray
#3d4551
C.lightGrayText
#a9aeb1
C.border
#dfe1e2
C.gold
#ffbe2e
C.goldBright
#f8e71c
C.red
#b50909
C.redDark
#9c3d10
C.green
#00a91c
C.greenBg
#ecf3ec
C.yellowBg
#faf3d1
C.redBg
#f4e3db
C.infoBg
#e7f6f8

Typography

Font families and heading styles used across the prototype

Heading Styles

H1 — Merriweather 32px Bold

H2 — Merriweather 20px Bold

H3 — Merriweather 16px Bold

Body text — Public Sans / Source Sans Pro, 14px, color: #1b1b1b. Line height 1.6 for readability. This is the default paragraph style used across all TTB-styled pages.

Helper text — 12px, color: #71767a. Used for labels, captions, and secondary information.

Buttons

Button styles and variants

Primary Buttons

Outline / Secondary Buttons

Icon Buttons

Status Badges & Pills

Used throughout the queue and review pages

Validation Status

Pass Fail Warning Info

Queue Statuses

SubmittedIn ReviewApprovedRejectedNeeds Revision

Category Badges

Beer Wine Spirits

Agent Status

ActiveAwayOffline

Card Patterns

Reusable card layouts used across pages

42
Stat Card
With Icon
98%
8
Passed

Form Elements

Input styles, selectors, and toggle controls

Text Inputs

Toggle Buttons (Segmented Control)

Selected: all

Upload Drop Zone

Drag & drop or click to upload
PNG, JPG, or PDF — max 10 MB

Alerts & Notices

Alert banner patterns

Info: This is an informational notice. Used for non-critical information.
Success: Operation completed successfully.
Warning: Please review this information carefully.
Error: Something went wrong. Please try again.

API Endpoints

All REST API routes available in the application

MethodEndpointDescription
POST/api/ocrExtract text from label image via OpenRouter vision model
POST/api/flattenAI-powered cylindrical/perspective label flattening (Lambda)
POST/api/explainLLM regulatory explanation for failed validation rules
GET/api/generate-labelList available COLA presets for label generation
POST/api/generate-labelGenerate realistic label image with Gemini AI
GET/api/queueList all queue submissions (filterable by status)
POST/api/queueCreate a new submission
GET/api/queue/{id}Get full submission detail
POST/api/queue/{id}Add a review (decision + findings + notes)
PATCH/api/queue/{id}Update submission status
POST/api/queue/seedRe-seed the queue with mock sample data

Features & Capabilities

Core features built into the prototype

Image Upload & Capture
Drag-and-drop, file picker, or camera capture. Supports PNG, JPG, PDF up to 10 MB.
Perspective Correction
Corner-point editor and mesh warp for flattening curved labels. Cylindrical unwrap for bottles/cans.
AI Flatten (Lambda)
Server-side cylindrical/perspective correction via AWS Lambda with OpenCV.
Smart Crop
Auto-detect label bounds within an image and crop to just the label region.
OCR (Two-Tier)
Browser-side Tesseract.js for instant results + Claude 3.5 Sonnet server OCR for higher accuracy.
Validation Engine
Category-aware rules: health warning, ABV format, net contents, class/type TTB lookup, cross-field checks.
Fuzzy Matching
Levenshtein distance comparison between COLA form fields and detected label text.
Review Queue
Full CRUD dashboard — submit, review, approve/reject/escalate with findings and notes.
AI Label Generation
Gemini AI generates photorealistic labels — flat, on-bottle, or on-can rendering styles.
API Test Console
Interactive endpoint tester with sample labels, JSON body editor, and response viewer.
Batch Upload
Process multiple label images at once with CSV export of validation results.
Guided Walkthrough
8-step tutorial panel with element highlighting for first-time users.

Tech Stack

Technologies and libraries powering the prototype

Next.js 14
App Router
TypeScript
Strict mode
React 18
Hooks + SSR
Tailwind CSS
Utility-first
Lucide React
Icons
Vitest
77 unit tests
Gemini AI
Label generation
OpenRouter
OCR + Explain
Tesseract.js
Browser OCR
AWS Lambda
AI flatten
Vercel
Deployment
MermaidJS
Architecture docs