Ticket box comes with Pro. Its preview shows once you unlock it.
Usage
import { EventTickets } from './EventTickets.jsx'
// Without onReserve the seats are held locally. Wire it to your server, which checks the seats left:
<EventTickets
locale="en"
types={types} // [{ id, name, note, price, left }]
max={6}
holdMinutes={10}
reservation={current} // { reference, type, quantity, total, expiresAt } kept on the server
onReserve={async (order) => {
const response = await fetch('/api/reservations', { method: 'POST', body: JSON.stringify(order) })
return response.ok ? (await response.json()).reservation : false
}}
onRelease={(held) => fetch('/api/reservations', { method: 'DELETE' })}
onPay={(held) => router.push('/checkout/' + held.reference)}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | Language of the built-in text and sample tickets; prices follow its format. |
types | Array<{ id, name, note, price, left }> | sample tickets | The ticket types; `left` is the seats still free (0 shows it sold out). An empty array shows “not on sale yet”. |
currency / max / holdMinutes | string / number / number | 'USD' / 6 / 10 | The currency of the prices, the most tickets per order, and how long seats are held. |
reservation | { reference, type, quantity, total, expiresAt } | — | A hold the visitor already has (from the server), shown with its timer. |
loading / error | boolean / boolean | string | false | Shows the skeleton while tickets load; shows the error banner with retry (a string replaces its sentence). |
onReserve | ({ type, quantity }) => Promise<{ reference, expiresAt } | false> | — | Holds the seats. Resolve false (or throw) when they are gone; the box says so and stays open. |
onRelease / onPay / onExpire | (held) => void | — | The visitor released the seats, went on to pay, or let the hold run out. |
onWaitlist / onNotify / onRetry | () => void | — | Joined the waiting list when sold out; asked for an email when sales open; pressed retry. |
labels | object | — | Replaces any built-in text (keys as in copy.js). |
Add it to your project
Pro includes the full source of this block. Copy its prompt to install it with your coding agent.
EventTickets.jsxevent-tickets.csscopy.jskit.jsxkit.cssui/base-button/ui/empty-state/ui/status-tag/ui/alert-banner/ui/success-check/ui/number-input/ui/radio-group/ui/skeleton-shimmer/tokens.cssREADME.md
The block, its stylesheet and text, the shared kit, the components it uses and tokens.css install together into one folder.
