Developers

Seat map

One script, no dependencies. The <seat-map> element is the quick way: it loads the chart, availability and prices and stays live. The SeatMap class is the same map with every option, for pages that load their own data.

The element

checkout.html
<script type="module" src="https://seatpublic.com/sdk/seatmap/v0/index.js"></script>

<seat-map api-base="https://api.seatpublic.com" event-id="ev_…"
          api-key="pk_test_…" max-selectable="8" no-orphan
          style="display:block; height:600px"></seat-map>

<script type="module">
const map = document.querySelector("seat-map");
map.addEventListener("seatSelect", e => console.log(e.detail.seat.id));
</script>

Attributes

AttributeWhat it does
api-base event-id api-keyLive mode: the event's chart, availability and prices from the API, then seat changes as they happen. Use the publishable key (pk_…).
chart-urlA chart file to show, without an event (previews, venue pages).
availability-urlWith chart-url: which seats are taken.
max-selectableHow many seats a buyer can pick. 0 = look only.
no-orphanRefuse picks that leave a single empty seat.
hold-on-select hold-secondsHold each seat the moment it is picked; how long it stays held after the page closes.
overlayavailability (default), category, rating or sellThrough.
color-schemeauto (default: the device's), light or dark.
currencyISO code for prices on the seat card, e.g. USD.
price-colors="off"Keep the chart's category colours instead of shading by price.
view-3dStart in the tilted view (venues with more than one level).
orientationauto, top or left: where the stage is.
seat-listThe id of an element to fill with a list of the best seats, beside the map.

The map object is on .map once loaded (and the live connection on .live), for the methods below.

Events

Eventdetail
seatSelect{ seat, section }: a seat was picked.
seatDeselect{ seat, section }: a seat was un-picked.
seatTaken{ seat, section }: a picked seat was taken by someone else, so it was un-picked. The map says so too.
ruleViolation{ code, seat, message }: a pick was refused. code is orphan, max, category or unavailable; the map shows message for a moment.
holdCreatedThe hold: { holdToken, expiresAt, until, seatIds }. The countdown runs to until while the page is open, or later if your server extended the hold.
holdExpiredThe hold that ran out.
holdConfirmedThe hold that was sold: the countdown stops and the picks clear.
holdErrorA seat couldn't be held (hold as you pick).
connection{ state }: the live connection's state.
error{ message }: the map couldn't load.

The SeatMap class

checkout.js
import { SeatMap } from "https://seatpublic.com/sdk/seatmap/v0/index.js";

const map = new SeatMap(document.getElementById("map"), {   // the element needs a height
  chart,                                // the venue chart
  availability,                         // GET /v1/events/{id}/availability
  pricing: { 1: 120, 2: 78 },            // this event's prices by category
  maxSelectable: 8, rules: { noOrphanSeat: true }, currency: "USD",
  onSelect: (seat, section) => {}, onDeselect: (seat, section) => {},
});
map.applyDelta([{ seatId: "orchestra-C-14", status: "held" }]);

Options

OptionTypeWhat it does
chart requiredVenueThe venue chart (JSON from the API or a chart file).
availabilityAvailabilityWhich seats are sold, held or blocked for this event (GET /v1/events/{id}/availability). Without it every seat is available.
pricingPricingThis event's prices by category id; shown on the seat card and passed to custom cards.
priceColorsbooleanColour categories by price when the event has two or more prices: cool for the cheapest, warm for the dearest (theme priceRamp), so buyers see where the deals are at a glance. Default on; host category colours still win.
overlayOverlayWhat colours the seats: 'availability' (default), 'category', 'rating', 'sellThrough', or a function (seat, section, status) returning a colour.
colorSchemeColorScheme'auto' follows prefers-color-scheme. CSS custom properties (--sc-*) on the container override either palette.
themePartial<Omit<SeatMapTheme, 'categoryOverride'>>Colours and font in code (CSS custom properties on the container win over these).
maxSelectablenumberHow many seats a buyer can pick at once. 0 = look only (no picking).
selectAnybooleanEvent managers: any seat can be selected whatever its status; category and orphan rules are skipped, and live changes never drop a seat from the selection. Buyers' maps leave this off.
rules{ noOrphanSeat?: boolean; allowedCategories?: number[] }What a buyer may pick: noOrphanSeat (never leave a single empty seat), allowedCategories. Checked here and again by the API.
cardfalse | ((info: SeatInfo) => HTMLElement | string | null)Seat card shown on hover/focus. Default: the buyer card (category, price, access, rating, photos, sell-through, tags). Return an element or an HTML string; return null to show nothing for that seat. false disables the card.
currencystringISO 4217 code used to format prices on the default card.
localestringBCP 47 locale for number/currency formatting.
sectionFirstboolean | 'auto'Section-first navigation: when zoomed out, draw sections as shapes (their lowest price, or how many seats are left) and zoom in on click; seats fade in as you zoom. 'auto' turns it on for charts above 500 seats (3,000 with labels: 'detailed', where staff want seats sooner).
filterSeatFilterWhat the buyer is looking for (the "2 tickets" and "Accessible" buttons): seats and sections that can't offer it are greyed.
labels'auto' | 'detailed'Row names (at both ends of each row) and seat numbers. 'auto' (default) shows them once zoomed in far enough to read; 'detailed' shows them from much further out, for editors and box-office staff.
zoomControlsbooleanOn-map zoom buttons (−, %, +, fit). Default true.
decorbooleanA livelier venue: a lit stage with footlights, warm light spilling into the room, and a soft tint of each section's category behind its seats. Default true; false draws a plain map.
floornumberMulti-level venues: the floor to show first, and whether to show the floor switcher (default true). By default every level shows at once (ALL_FLOORS): one plan from above with the upper levels around the lower ones ('top'; one level on its own keeps its place in that plan, so switching glides rather than jumps), or side by side ('side'); the switcher narrows to one. allLevels: false shows one level at a time (the editor, which edits real coordinates), starting with the chart's first.
allLevelsboolean | 'top' | 'side'Every level at once (true or 'top': one plan from above; 'side': side by side) or one at a time (false).
view3dbooleanStart in the tilted 3D view of all levels: each level raised on its slab, the room seen from the back at an angle. Buyers switch with the 3D button beside the zoom (shown for venues with more than one level). Default false.
orientation'auto' | 'top' | 'left'Where the stage is: 'auto' (default: whichever shows the venue bigger in the map's box, rechecked when the box changes shape), 'top', or 'left' (the hall running to the right, the way wide screens show a deep venue). A bird's-eye view either way; the tilted 3D view is stage-on-top only. Display only: seat ids and the chart don't change.
floorSwitcherbooleanThe level tabs over the map on multi-level venues. Default true.
filterBarbooleanThe buyer's filters as a row of chips over the map (quantity, price, seat types, accessible, level), shown when they mean something. Default true; false shows just the level tabs (the editor and the manager view).
onFloorChange(floorId: number) => voidThe buyer switched level (or setFloor was called).
onSelect(seat: Seat, section: Section) => voidA seat was picked.
onDeselect(seat: Seat, section: Section) => voidA seat was un-picked (by the buyer, or because it sold or was held elsewhere).
onHover(seat: Seat | null, section: Section | null) => voidThe pointer moved onto a seat, or off all seats (null).
onRuleViolation(code: RuleViolation, seat: Seat) => voidA pick was refused: 'unavailable', 'category', 'max' or 'orphan' (it would leave a single empty seat).
onSeatTaken(seat: Seat, section: Section) => voidA seat the buyer had picked was taken by someone else and unpicked (onDeselect fires too). The map says so on screen.
onHoldCreated(hold: HoldInfo) => voidA hold started (startHold, or hold as you pick).
onHoldTick(remainingMs: number) => voidCalled every second while a hold is running.
onHoldExpired(hold: HoldInfo) => voidThe hold ran out: its seats go back on sale.
toastsbooleanShort notes over the map for a moment: why a pick was refused ("That would leave a single empty seat…"), and a picked seat someone else just took. Default true.
announcebooleanScreen-reader announcements (picks, focus, zoom steps). Default true; see setAnnouncements() to pause them for a while.
onViewChange() => voidCalled whenever the camera moves (pan, zoom, fit).
ariaLabelstringWhat screen readers hear for the canvas, in place of the buyer instructions (an editor's keys are different).
insets() => Partial<Insets>Screen space the host covers with its own controls (a tool rail, a side panel, a bar along the bottom), in CSS pixels from each edge. Fitting and zooming to sections or seats centre the chart in what is left, and reveal() keeps things out from under them. Called each time, so it can follow panels that open and close.
drawUnderlay(ctx: CanvasRenderingContext2D) => voidExtra drawing under the stage and seats (used by the editor for a traced floor plan). Screen pixels; use map.toScreen().
drawExtras(ctx: CanvasRenderingContext2D) => voidExtra drawing after seats (used by the editor). Coordinates are screen pixels; use map.toScreen().
onPointer(phase: 'down' | 'move' | 'up' | 'cancel', e: PointerEvent, world: [number, number]) => booleanFirst refusal on pointer input (used by the editor). world is the pointer in world units. Return true from 'down' to own the gesture: its 'move' and 'up' then come here and the map neither pans nor selects. Hover moves (no button) also come here first; return true to suppress the map's own hover. Wheel zoom always stays with the map.
keyboardbooleanSet false to let the host handle keys (the editor); the map then ignores arrows, Enter, +/-, 0 and Esc.

Methods

MethodWhat it does
setChart(chart) getChart()Show another chart, or read the current one. Pass new objects for whatever changed: sections it has seen before are reused as they are.
setAvailability(a) applyDelta(changes)All seat statuses at once, or a few changes ([{ seatId, status }]).
setPricing(p) priceOf(seatId)This event's prices by category; a seat's price.
getCategories()The ticket types with the colours the map uses, for your own price key.
seatInfo(seatId) statusOf(seatId)A seat's section, status, category and price; or just its status.
select(id) deselect(id) setSelection(ids)Pick seats from code (the rules apply).
getSelection() clearSelection()The picked seats; un-pick them all.
setFilter(f) getFilter() showMatches()What the buyer is looking for ({ quantity, accessible }): seats that can't offer it are greyed; zoom to the sections that can.
offers() onOffersChange(fn)The best seats that fit the filter, cheapest first; a callback when they may have changed.
highlight(ids) zoomToSeats(ids)Outline seats (null to clear); bring them into view.
getFloors() getFloor() setFloor(id)Levels of a multi-level venue.
setView3d(on) setOrientation(o) setLabels(mode)The tilted view; where the stage is; row names and seat numbers sooner (detailed).
setOverlay(o) refresh()What colours the seats; recolour after a custom overlay's inputs change.
setColorScheme(s) refreshTheme()Light, dark or auto; read the --sc-* colours again after changing them.
fit() zoomToSection(id) zoomBy(f) reveal(box)Move the view: the whole chart, one section, in or out, or just enough to show a box.
getView() setView(v) toScreen(x, y) toWorld(x, y)The camera, and converting between chart and screen positions.
startHold(h) updateHold(h) endHold() holdRemainingMs()Show a hold's countdown (after POST /v1/events/{id}/holds); updateHold moves its end. In live mode the map does this itself.
setAnnouncements(on)Pause what screen readers hear from the map, e.g. while your page plays a demo on it.
destroy()Remove the map and its listeners.

Colours

Set any of these CSS custom properties on the map's container (they win over the theme option), then call refreshTheme() if you change them later.

PropertyColours
--sc-category-1 … --sc-category-20Each category (win over the chart's own colours).
--sc-price-rampPrice shading, cheapest first: #0d9488, #2563eb, #c2185b.
--sc-sold --sc-held --sc-blocked --sc-blocked-hatchSeats that can't be picked.
--sc-accent --sc-focusPicked seats; the keyboard focus ring.
--sc-stage --sc-stage-text --sc-stage-glow --sc-tableThe stage, its name, its light; tables.
--sc-label --sc-label-bg --sc-row-text --sc-seat-textSection names, row names and seat numbers.
--sc-bg --sc-fontThe background; the font for text on the map.
--sc-card-bg --sc-card-fg --sc-card-line --sc-card-muted --sc-card-good --sc-card-badThe seat card, level tabs, zoom buttons and filters.

Box office screen

SeatManager is the staff screen: the map with every seat selectable, beside a panel with live counts. Staff see who holds or bought a seat, block and unblock seats (named, like "Press"), change categories for this event, and undo. Other staff's changes and buyers' holds show up as they happen.

box-office.js
import { SeatManager } from "https://seatpublic.com/sdk/seatmap/v0/index.js";

const manager = await SeatManager.connect(document.getElementById("manager"), {
  apiBase: "https://api.seatpublic.com", eventId,
  // your server makes the pass: POST /v1/events/{id}/manager-tokens with the secret key
  token: () => fetch(`/admin/events/${eventId}/seat-token`).then(r => r.json()).then(r => r.token),
  onSellRequest: ({ seats }) => openSale(seats),       // you sell, then PATCH the seats sold with the order
  onRefundRequest: ({ orders }) => openRefund(orders), // you refund, then call seats/release
});
OptionWhat it does
apiBase eventIdThe API and the event.
tokenA staff pass (mt_…), or a function that fetches one from your server. With a function the screen renews the pass before it runs out.
permissionsWhat the pass allows (view, status, category), to hide the rest. The server checks either way.
onSellRequest onRefundRequestSell or refund in your own system. Without them, those buttons aren't shown. A pass never sells or refunds.
onConnection onErrorThe live connection's state; a message when something fails.

The pass request and its answer: quickstart, box office screen.

Questions? Write to [email protected].