Flight Seat Map

A 3D aircraft cabin where your head pops up over the seat you pick.

Preview

"use client";

import { useState } from "react";
import {
  FlightSeatMap,
  type SeatMapLayout,
  type SeatPassenger,
  type SeatSelection,
} from "@/components/motion/flight-seat-map";

const layout: SeatMapLayout = {
  columns: ["A", "B", "C", "", "D", "E", "F"],
  sections: [
    { from: 1, to: 2, type: "premium", price: 89 },
    { from: 3, to: 4, type: "extra-legroom", price: 39 },
    { from: 5, to: 12, type: "standard" },
  ],
  exitRows: [4],
};

const passengers: SeatPassenger[] = [
  { id: "p1", name: "Maya Chen" },
  { id: "p2", name: "Leo Park" },
];

const taken = ["1A", "2E", "3C", "4F", "5A", "5B", "6E", "7C", "7D", "8F", "9B", "10A", "10E", "11C", "12D", "12F"];

export function FlightSeatMapPreview() {
  const [seats, setSeats] = useState<SeatSelection>({ p1: "3B", p2: null });

  return (
    <div className="w-full max-w-4xl">
      <FlightSeatMap
        layout={layout}
        passengers={passengers}
        taken={taken}
        value={seats}
        onChange={setSeats}
        sound
      />
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/flight-seat-map

API Reference

layout
SeatMapLayout

The cabin layout: seat columns, aisles, sections, exit rows and skipped rows.

passengers
SeatPassenger[]

Everyone who needs a seat. One passenger makes it a single-seat picker.

taken?
string[]

Seat ids that are already taken, such as ["3C", "12A"].

Default[]
value?
SeatSelection

Selected seats, for controlled use.

defaultValue?
SeatSelection

Selected seats at first, when uncontrolled. Default: {}

Default{}
onChange?
((value: SeatSelection) => void)

Called with the whole selection whenever a passenger's seat changes.

currency?
string

ISO 4217 currency code for seat prices. Default: "USD"

DefaultUSD
tilt?
number

How far the cabin floor tips away from the viewer, in degrees. 0 draws it flat from above. Default: 42

Default42
sound?
boolean

Play a pop when a head lands in a seat, a flick when a seat is given up, a click when switching passengers and a buzz on a taken seat. Off by default; a `SoundProvider` can mute it app-wide. Default: false

Defaultfalse
labels?
Partial<{ map: string; row: string; aisleColumn: string; seat: string; window: string; middle: string; aisle: string; standard: string; "extra-legroom": string; premium: string; available: string; taken: string; ... 10 more ...; hint: string; }>

Override any built-in string.

className?
string

Classes merged onto the root element.

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated