Seat map
A cabin from your layout data with passenger assignments, deck switching and a pinchable viewport.
npx @swipeui/cli add seat-mapWhen to use it
- Assign places to several travellers from a supplied layout.
When not to use it
- A generic editable floor plan.
Installation
Installs with a Pro licence
Everything on this page is public except the source. Founder pre-sale opens around 5 January 2027.
Usage
import { SeatMap, buildCabin } from '@/components/swipeui/special/seat-map';
const layout = {
decks: [
{
id: 'main',
label: 'Main',
sections: [buildCabin({ rows: [1, 30], pattern: 'ABC DEF', exitRows: [12] })],
},
],
};
<SeatMap layout={layout} passengers={[{ id: 'p1', name: 'Alex' }]} />;Examples
The single-aisle, twin-aisle and two-decks boards all assign seats to two travellers.
SeatMap settings
| Prop | Does | Default |
|---|---|---|
layout | Decks containing labelled sections, numbered rows and seat, aisle, gap or facility cells | Required |
passengers | ID, name and optional initials per traveller | Required |
value, defaultValue, onValueChange | Passenger ID → seat ID, controlled or uncontrolled | {} |
activePassenger, onActivePassengerChange | Active traveller | First |
autoAdvance | Advance to another unassigned traveller after assignment | true |
deck, defaultDeck, onDeckChange | Active deck; assignments survive switching | First |
zoom | Pinch, two-axis pan, double tap and icon buttons on the cabin | true |
miniMap | Aircraft overview with viewport rectangle, on the cabin | true |
legend | Five seat-state swatches with marks and labels | true |
details | Price, status and amenities in a popover by the seat, a dock below, or none | popover |
detailsTimeout | Milliseconds the popover stays after a press or long press; 0 keeps it | 2400 |
total | Separate subtotals per currency | true |
locale | Price formatting locale | en-US |
onSeatPress | Reports all seat presses, including refusals | — |
disabled | Prevent interaction | false |
haptics | select, blocked, deck, or all off | true |
revealSpeed | Row reveal: slow, normal, fast or milliseconds per row | slow |
messages | Built-in labels, amenities, seat and assignment formatters | English |
motion | Shared motion override | App feel |
className, style, testID | Root and part hooks | — |
Composition and behaviour
buildCabin returns a section. Compose any number of sections and decks; use
idPrefix when decks reuse row numbers. A facility cell supports kind and span.
Price amounts are integer minor units with an ISO currency code. Zero- and
three-decimal currencies are formatted correctly; unlike currencies stay separate.
Moving a traveller frees their old seat. Choosing their current seat removes it.
Occupied, blocked and other travellers' seats refuse assignment.
The cabin is drawn as an aircraft. Rows flagged wing place the wings, and a deck
without them has none. Seat colour shows availability (green available, grey
occupied, red blocked, primary selected) and every state keeps a mark. Hover a
seat with a pointer, hold it, or press it for a popover with its price, status
and amenities; pass priceFor to buildCabin to price a cabin by rule.
The nose and physical seat order stay fixed in RTL. Each seat is a named button with amenities, price, state and its traveller. Zoom buttons give a gesture alternative. At fitted zoom dense seats are smaller: zoom in for full targets. Chrome stays outside the transform. Rows window after the gesture settles with overscan; use the zoom buttons to bring other rows into view with a screen reader. Wrap the component in a pan-owning region when embedding it in a scrolling screen. Reduce Motion shows every row immediately and keeps direct manipulation.
Native accessibility, device motion checks and recordings remain pending.
Behavior and gestures
- Tap a place to assign the active traveller; unavailable places keep their marks.
- Pinch, pan in both directions or double tap the cabin; use the equivalent zoom buttons.
- Change decks without losing assignments.
Accessibility
- Each place is a named button with amenities, state and price.
- Physical seat order remains left to right in RTL.
Motion
- Uses the
dragandtogglemotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The cabin follows the fingers, settling on drag.
- Rows reveal at a readable pace set by revealSpeed; toggle fades the seats. Reduce Motion shows the final state.
Performance
- Static cabin art is memoised; gestures transform one layer.
Notes for AI
- Prices use integer minor units and an ISO currency. Mixed currencies get separate totals.
- Wrap the canvas in a pan-owning region on a scrolling showcase.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.