Initializing SDK

The Booking Renderer SDK (@seatmap.pro/renderer) is the embeddable seat picker that runs on your selling page. It connects to the Booking API, renders the venue layout in Canvas2D or, with switchToWebGL: true, in WebGL, and fires callbacks when customers select or deselect seats.

Prerequisites

  • Node.js 18+ (LTS recommended)
  • npm, yarn, or pnpm package manager
  • A published schema and event created via the Getting Started guide
  • Your Public API key from Organization Settings in Editor

Step 1: Install the package

npm install @seatmap.pro/renderer
yarn add @seatmap.pro/renderer
pnpm add @seatmap.pro/renderer

Package details: @seatmap.pro/renderer on npm

Step 2: Add a container element

The renderer mounts into a DOM element on your page. Give it explicit dimensions:

<div id="seatmap-root" style="width: 100%; height: 600px;"></div>

The renderer fills the container completely. Use CSS to control the chart size within your page layout.

Step 3: Initialize the renderer

import { SeatmapBookingRenderer } from '@seatmap.pro/renderer';

const container = document.getElementById('seatmap-root')!;

const renderer = new SeatmapBookingRenderer(container, {
  publicKey: 'YOUR_PUBLIC_API_KEY',
  onSeatSelect: (seat) => {
    console.log('selected', seat);
  },
  onSeatDeselect: (seat) => {
    console.log('deselected', seat);
  },
});

await renderer.loadEvent('YOUR_EVENT_ID');

Required values:

  • publicKey – from Organization Settings in Editor, in the menu under your own name
  • eventId – returned when you create an event via the Booking API v2 or the Events Hub UI

Step 4: Handle seat selection

The onSeatSelect callback fires each time a customer clicks an available seat. Use it to sync the selection with your cart or backend.

For production ticketing, the recommended pattern is lock-per-click: lock the seat in your backend immediately on selection, and unlock on deselection.

const renderer = new SeatmapBookingRenderer(container, {
  publicKey: 'YOUR_PUBLIC_API_KEY',
  onSeatSelect: async (seat) => {
    await fetch('/api/cart/lock', {
      method: 'POST',
      body: JSON.stringify({ seatId: seat.id }),
    });
  },
  onSeatDeselect: async (seat) => {
    await fetch('/api/cart/unlock', {
      method: 'POST',
      body: JSON.stringify({ seatId: seat.id }),
    });
  },
});

onSeatSelect and onSeatDeselect report the changes a buyer’s clicks make. A click on a blocked seat that is not in the cart calls no callback; see Interaction blocking. The cart methods addSeatsToCart, removeSeatsFromCartByIds, removeSeatsFromCartByKeys and clearCart fire neither onCartChange nor these callbacks, so after calling one of them, update your cart summary and any cart you keep on your server from renderer.getCart().

For the full callback and settings reference, see the Renderer Spec.

Optional features

3D view

The 3D view is a tilted perspective view of the seating chart. It needs the WebGL renderer, so set switchToWebGL: true together with enable3DView: true. Constrained GPU mode lists when the renderer falls back to a flat map.

const renderer = new SeatmapBookingRenderer(container, {
  publicKey: 'YOUR_PUBLIC_API_KEY',
  switchToWebGL: true,
  enable3DView: true,
});

await renderer.loadEvent('YOUR_EVENT_ID');

await renderer.animateTo3DParams({ pitch: Math.PI / 4, fieldOfView: Math.PI / 9 });

set3DViewEnabled(enabled) turns the 3D view on or off on a shown map, and get3DViewParams() returns the camera in effect. pitch tilts the map from 0 (top-down) up to 70 degrees, fieldOfView sets the perspective from 0 (none) up to 45 degrees, and rotationZ turns the map. All three are in radians, and values past the limits are clamped. The earlier tiltX (about -0.33 to 0) and perspectiveZ still work, and when a call changes both forms, pitch and fieldOfView win. The map opens fitted to its tilted shape, and a padding above 0.5 applies to the flat view only.

Buyers turn the map by twisting two fingers and tilt it by moving two fingers up or down. With a mouse, a drag with the right button, or with Ctrl held, turns it horizontally and tilts it vertically, and a Ctrl click still selects. Set enableCameraGestures: false to turn the gestures off.

Levels

A map can define named levels, such as Stalls and Balcony. Set enableLevels: true to show them: section heights in the 3D view, a Floor selector, dimming of the other levels and vector section artwork. The setting defaults to false, and the renderer then ignores level definitions and section heights and shows no Floor selector.

const renderer = new SeatmapBookingRenderer(container, {
  publicKey: 'YOUR_PUBLIC_API_KEY',
  enableLevels: true,
  onActiveLevelChange: (levelId) => {
    console.log('active level', levelId);
  },
});

getLevels() lists the levels and getActiveLevel() returns the active level id. setActiveLevel(levelId) switches floors: pass a level id, an empty string for sections that sit on no level, or null for all floors. Choosing a floor dims the other levels, with the opacity that inactiveLevelOpacity sets (0.15 by default), and limits interaction to that floor; selections and cart contents survive the switch. Set levelSelector: { enabled: false } to hide the Floor selector and switch floors from your own controls.

Try it live

Open the Renderer Playground to experiment with the SDK interactively – no setup required.

A complete working example is also available on CodePen.

Troubleshooting

Container not visible – the renderer needs a container with non-zero width and height. If nothing appears, check that the container element has explicit CSS dimensions.

CORS errors – the renderer fetches data from booking.seatmap.pro. If you use a proxy or custom domain, ensure your server forwards requests to the Booking API with the correct Origin header.

No seats displayed – verify that the event has prices assigned to seats. The renderer only shows seats with at least one price assignment.

Learn more

Type a feature, setting, endpoint or SDK method.