StealThis .dev

Ticketing — QR Ticket Stub

A mobile entry-pass stub component shown across three lifecycle states — valid, used, and expired. Each card pairs a photographic gradient hero with a floating state badge, a perforated torn-stub divider with rounded notches, and a colour-coded seat tier legend. A faux QR pattern carries a live scan-pulse ring while valid, enlarges into an accessible lightbox on tap, and a mark-as-used demo flips a ticket to scanned with a timestamp and toast. Keyboard friendly and responsive to 360px.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

QR Ticket Stub

A self-contained mobile entry pass built like a real torn ticket. Each stub leads with a photographic gradient hero carrying the event category, title, date, and venue, with a pill-shaped state badge floating in the corner. Below the hero, a dashed perforation line with two rounded background notches sells the torn-stub illusion, separating the seat facts and QR block from the holder footer. A small tier legend dot colour-codes the seating tier alongside the section, row, and order number.

The grid renders three lifecycle states side by side. A valid pass animates a green scan-pulse ring around its QR and a blinking status dot; a used pass greys its code and shows the scan timestamp; an expired pass desaturates and locks entry. Tapping any QR — or pressing Enter or Space on a focused card — opens an accessible modal lightbox with an enlarged, grouped code and a present-at-gate note, dismissible by Escape, backdrop click, or the close button.

The mark-as-used demo flips a valid ticket to the used state in place: the badge text, footer button, and QR hint update to a live timestamp, and a toast confirms entry. Buttons on already-used or expired passes explain why entry is closed instead of acting. Everything is vanilla JavaScript with no dependencies, WCAG-minded contrast, and a single-column reflow at narrow widths.

Illustrative UI only — fictional events, not a real ticketing service.