SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

SeatMap

An aircraft cabin seat picker.

Choose a seat

Main deck · LK 482

Larkwing Plus

Economy

  • Available
  • Your seat
  • Extra legroom
  • Exit row
  • Taken
View code
tsx
<form method="post">
	<SeatMap
		name="seat"
		label="Choose a seat"
		labels={{ taken: "taken", aisle: "aisle", window: "window", exit: "exit row", kinds: { "extra-legroom": "extra legroom", exit: "exit seat" } }}
		layout="ABC DEF"
		rows={rows}
		selected="14C"
		deck="Main deck · LK 482"
		exitRows={[12]}
		wings={[12, 17]}
		sections={[{ from: 10, title: "Larkwing Plus" }, { from: 11, title: "Economy" }]}
	/>
	<SeatMap.Legend
		items={[
			{ swatch: "available", label: "Available" },
			{ swatch: "selected", label: "Your seat" },
			{ swatch: "extra-legroom", label: "Extra legroom" },
			{ swatch: "exit", label: "Exit row" },
			{ swatch: "taken", label: "Taken" },
		]}
	/>
</form>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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.

Composition

The parts the component publishes, each a static property of the host.

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

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
rowsRow[]Yes
layoutstringYesSeat letters in cabin order, a space for each aisle, e.g. "ABC DEF".
namestringYesThe form field the picked seat's id posts under.
selectedstringNoThe seat id checked on load.
labelstringYesNames the radio group for assistive technology, e.g. "Choose a seat".
labelsLabelsYes
deckRemixNodeNoA visible header under the nose, such as "Main deck · Larkwing A321".
wings[number, number]NoFirst and last rows the wing spans, drawn on both walls.
exitRowsnumber[]NoRows with an emergency exit, marked on both walls.
sectionsSection[]NoSection titles, each drawn above the row it starts at.
requiredbooleanNoAsks the browser to require a pick before the form submits.

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

SeatMap.Legend

PropTypeRequiredDescription
itemsLegendItem[]Yes

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

Types

NameValuesWhat 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.
@sdxc/ui

Can’t find it? Contact us