Staaarter

Flight Booking

A list of flight result cards showing airline, times, duration, stop count, and baggage info. A shared Economy/Business/First fare-class switcher above the list changes the displayed price on every card at once, since each flight's demo data carries a price per class.

By Staaarter Team
Booking
Docs
Live preview

Docs

Installation

A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its button, badge, avatar-initials dependencies and any missing npm packages, and installs them straight into your project.

npx shadcn add https://staaarter.com/r/flight-booking.json

Prefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/booking/booking8.tsx instead.

Usage

The file also exports booking8Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.

import { Booking8, booking8Demo } from "@/components/blocks/booking/booking8";

export default function Page() {
  return <Booking8 {...booking8Demo} />;
}

Props

PropTypeDefaultDescription
headingstring"Choose your flight"Section heading.
descriptionstring"Prices update instantly based on the fare class you select."Short subheading under the heading.
flightsFlightResult[]noneFlight results to list, each with a price per fare class.
classNamestringnoneExtra classes for the outer section element.

Types

interface FlightResult {
  id: string;
  airline: string;
  flightNumber: string;
  departTime: string;
  departAirport: string;
  arriveTime: string;
  arriveAirport: string;
  duration: string;
  stops: "Nonstop" | "1 stop";
  baggage: string;
  price: { economy: number; business: number; first: number };
}

Behavior notes

  • The Economy/Business/First pill switcher is real shared client state: selecting a class re-renders the displayed price on every flight card at once from that flight's per-class price data.
  • Each flight card's "Select" button is decorative only, nothing is booked or sent anywhere.