# SeatMap

> An aircraft cabin seat picker: a fuselage with a rounded nose, column letters over a grid of seats, row numbers down the aisle and exits marked on both walls.

```ts
import { SeatMap } from "@sdxc/ui/travel";
```

Renders the cabin as a `<fieldset>` named by `label`. Each seat is a radio named `name` with
the seat's id as its value, so the pick posts with the form and arrow keys move through the
cabin natively; taken and blocked seats are disabled radios.

## Examples

```tsx
<SeatMap
	name="seat"
	label="Choose a seat"
	labels={{ taken: "taken", aisle: "aisle", window: "window", exit: "exit row" }}
	layout="ABC DEF"
	rows={rows}
	selected="14C"
	exitRows={[12]}
	wings={[10, 18]}
/>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `rows` | `Row[]` |  |
| `layout` | `string` | Seat letters in cabin order, a space for each aisle, e.g. "ABC DEF". |
| `name` | `string` | The form field the picked seat's id posts under. |
| `selected?` | `string` | The seat id checked on load. |
| `label` | `string` | Names the radio group for assistive technology, e.g. "Choose a seat". |
| `labels` | `Labels` |  |
| `deck?` | `RemixNode` | A visible header under the nose, such as "Main deck · Larkwing A321". |
| `wings?` | `[number, number]` | First and last rows the wing spans, drawn on both walls. |
| `exitRows?` | `number[]` | Rows with an emergency exit, marked on both walls. |
| `sections?` | `Section[]` | Section titles, each drawn above the row it starts at. |
| `required?` | `boolean` | Asks the browser to require a pick before the form submits. |

Also accepts everything in `Omit<TagProps<"fieldset">, "children">`.


### SeatMap.Legend

Renders the key to the cabin: a wrapping list of swatches drawn exactly like the seats they explain, each beside the caller's caption.

| Prop | Type | Description |
| --- | --- | --- |
| `items` | `LegendItem[]` |  |

Also accepts everything in `Omit<TagProps<"ul">, "children">`.


## Types

| Name | Values | What it decides |
| --- | --- | --- |
| `Status` | `"available" \| "taken" \| "blocked"` | Whether a seat can be picked; `"taken"` and `"blocked"` seats render disabled. |
| `Kind` | `"standard" \| "extra-legroom" \| "exit" \| "premium"` | What a seat offers; every kind but `"standard"` is tinted. |
| `Swatch` | `"available" \| "selected" \| "taken" \| "blocked"` | What one legend entry explains. |
