# Seat view

A cinema seat map that turns into the view from the seats you picked: the room in perspective, lit slats down the walls, a dusk frame on the screen, the seat backs in front. Drag to look around; the edges give like rubber.

Object · With a Pass · https://tactileui.dev/objects/seat-view

> The code and styling for this object come with the Pass. Sign in if you have one. Sign in: https://tactileui.dev/auth/sign-in The price: https://tactileui.dev/pricing

## Use it

With a Pass, install it with npx shadcn add @tactile/seat-view (https://tactileui.dev/docs/registry-and-mcp). It lands in tactile/seat-view/.

Load the stylesheet as well as the module, or it renders unstyled: tactile/seat-view/seat-view.css. In a bundler such as Vite, import each CSS file next to the module import; in plain HTML, link it.

Then new SeatView(element, options) from tactile/seat-view/seat-view.mjs. Every option has a default; tactile/seat-view-example.html shows it running. The sample copy (headings, labels, figures) is placeholder: replace it with the page's own.

## Anatomy

Pinhole camera, Near plane clipping, Painters order room, Camera from pick, Map to view dolly, Soft limit rubber band, Drag and key look, Roving seat grid, Token driven materials, Sleeping loop

## Usage notes

Give a booking screen (a cinema, a theatre, a stadium block, a lecture hall) a map where the choice is shown to the visitor before they pay for it: seats are raised keys under one lamp, a picked seat latches with a lamp lit in it, and picking the party's last seat turns the picture window into the room as seen from those seats. The camera comes from the picked row and column, so a front aisle seat and a seat in the middle at the back give different rooms. A row strip stays at the bottom with where you are sitting, the key back to the map and a Book key with the total.

## Options

| Option | Type | Description |
| - | - | - |
| tickets | number | How many seats the party picks. Picking more than this drops the oldest pick; the stepper on the panel changes it too. |
| crowd | number | The share of seats already taken, drawn as sunk dark keys on the map and as heads over the seat backs in the room. The same number is always the same crowd. |
| start | enum | The map, or the view from the best free seats together near the middle of the hall. |
| label | text | Read by a screen reader for the whole panel. Empty uses the default. |

## Methods

- isTaken
- pick
- enter
- leave
- camera
- look
- state
- stats
- update
- destroy

## States

1. **Map**: Rows A to H in two blocks of five either side of an aisle, a curved screen line above them. Free seats are raised keys; taken seats are sunk and dark and say so to a screen reader; yours are latched with the blue lamp lit and the seat number printed in them. The loop is asleep and costs nothing.
2. **Picking**: Click, or arrow to a seat and press Enter. The strip names the seats and the total. A new pick beyond the ticket count lets the oldest go.
3. **Map to view**: Leaving is faster. No bounce.
4. **View**: The room as seen from the picked seats: slat walls lit from behind, downlights, the screen showing a dusk frame in the lamp colours, the treads with amber aisle lights, the seat backs in front with heads over the taken ones. The row strip stays at the bottom.
5. **Looking around**: Drag (mouse, pen or finger) or use the arrow keys. The room follows the hand. Past the limit the view gives like rubber, no more than a third of the limit, and settles back on the limit when let go, with no overshoot. Home centres it; Escape goes back to the map.
6. **Tickets**: The stepper at the top right sets 1 to 4 tickets. Fewer tickets than picked seats lets the oldest picks go.
7. **Booked**: Book shows a green lamp and the word Booked, and fires the seat-view-book event with the seats and the total. Nothing is sent anywhere. Changing a seat or the ticket count clears it.
8. **Off screen or hidden**: The loop stops; a returning tab cannot jump the settle because the first frame gap is clamped.
9. **Phone**: A drag in the view looks around instead of scrolling the page.
10. **Reduced motion**: The view is still draggable. No loop runs at all: a change is drawn once, where it happens.

## How it works

Original. One 2D canvas, no WebGL and no image or font: the room is polygons clipped to a near plane and drawn far to near. It needs the Tactile UI Kit's stylesheet on the page (the keys and the stepper); the Code tab's example links it from ./kit/. The picture window is a dark display in aluminium and graphite alike (a cinema is dark); the panel, strip and keys follow the finish.
