# Boarding Pass

> A wide airline boarding pass card with route hero, 4-column boarding metadata, clipped perforation notches, and barcode footer.

- Kind: ui · Category: Data display · Interactivity: none
- Install: `npx shadcn@latest add @haze/boarding-pass`
- File: `src/components/haze/ui/boarding-pass.astro`
- npm dependencies: @lucide/astro
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/boarding-pass

## Use when
- Presenting a confirmed flight itinerary with gate, boarding time, seat, group, and scannable pass stub.
- Showing a crisp digital travel ticket or event pass with structured departure metadata.

## Avoid when
- Users need to compare multiple itineraries side by side. Use a table or card list.
- The record is generic key-value data without a route or ticket stub. Use description-list.

## Alternatives
- [card](https://hazeui.com/ui/card.md)
- [description-list](https://hazeui.com/ui/description-list.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| airline | `string` | "Bramble" | no | Carrier or issuer name displayed in the pass top bar. |
| flightNumber | `string` | "NW 214" | no | Flight number displayed beside the airline name. |
| status | `string` | "On time" | no | Live flight status badge label. |
| departureCode | `string` | "LIS" | no | Three-letter departure IATA airport code. |
| departureCity | `string` | "Lisbon" | no | Departure city name. |
| departureTime | `string` | "10:40" | no | Scheduled departure time. |
| arrivalCode | `string` | "CPH" | no | Three-letter arrival IATA airport code. |
| arrivalCity | `string` | "Copenhagen" | no | Arrival city name. |
| arrivalTime | `string` | "15:05" | no | Scheduled arrival time. |
| gate | `string` | "B12" | no | Departure gate assignment. |
| boardingTime | `string` | "10:05" | no | Gate boarding time. |
| seat | `string` | "14A" | no | Assigned seat code. |
| boardingGroup | `string` | "2" | no | Boarding group or zone number. |
| date | `string` | "Thu, 12 Nov" | no | Travel date displayed in the notice and passenger stub. |
| notice | `string` | "Doors close 15 min before departure" | no | Boarding cutoff notice line. |
| passenger | `string` | "Maya Chen" | no | Passenger full name in the barcode footer. |
| passCode | `string` | "NW0214-LISCPH-14A" | no | Seed string used to generate the deterministic barcode pattern. |
| headingLevel | `2 \| 3 \| 4` | 3 | no | Heading level for the airline title. |
| class | `string` |  | no | Additional classes on the outer boarding pass card. |

## Accessibility
- The airline mark, flight path graphic, perforation cutouts, and SVG barcode are marked aria-hidden so screen readers focus on real flight text.
- Gate, boarding time, seat, and boarding group are structured inside a semantic definition list.
- Perforation cutouts are clipped inside overflow-hidden to keep horizontal layout intact down to 320px viewports.

## Agent prompts

### Install and use

Install the Haze UI component "Boarding Pass" with `npx shadcn@latest add @haze/boarding-pass`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import BoardingPass from "@/components/haze/ui/boarding-pass.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/boarding-pass.md

### Customize with real content

Adapt the Haze boarding-pass ui for our product. Replace the demo values of these props with our real content: airline, flightNumber, status, departureCode, departureCity, departureTime, arrivalCode, arrivalCity, arrivalTime, gate, boardingTime, seat, boardingGroup, date, notice, passenger, passCode, headingLevel, class. Keep the layout, the heading level rules and these accessibility details: The airline mark, flight path graphic, perforation cutouts, and SVG barcode are marked aria-hidden so screen readers focus on real flight text. Gate, boarding time, seat, and boarding group are structured inside a semantic definition list. Perforation cutouts are clipped inside overflow-hidden to keep horizontal layout intact down to 320px viewports. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using boarding-pass, check it fits: use it when presenting a confirmed flight itinerary with gate, boarding time, seat, group, and scannable pass stub.; showing a crisp digital travel ticket or event pass with structured departure metadata.. Avoid it when users need to compare multiple itineraries side by side. use a table or card list.; the record is generic key-value data without a route or ticket stub. use description-list.. Alternatives: @haze/card, @haze/description-list.

## Example requests that should lead here
- Display a Bramble boarding pass from LIS to CPH with On time badge, gate B12, seat 14A, and barcode footer.
- Add a wide airline ticket card showing route codes, 4-column boarding details, perforated tear line, and passenger stub.

## Source

```astro
---
import { Compass, Plane } from "@lucide/astro";
import { cn } from "../../../lib/haze/utils";

interface Props {
  airline?: string;
  flightNumber?: string;
  status?: string;
  departureCode?: string;
  departureCity?: string;
  departureTime?: string;
  arrivalCode?: string;
  arrivalCity?: string;
  arrivalTime?: string;
  gate?: string;
  boardingTime?: string;
  seat?: string;
  boardingGroup?: string;
  date?: string;
  notice?: string;
  passenger?: string;
  passCode?: string;
  headingLevel?: 2 | 3 | 4;
  class?: string;
}

const {
  airline = "Bramble",
  flightNumber = "NW 214",
  status = "On time",
  departureCode = "LIS",
  departureCity = "Lisbon",
  departureTime = "10:40",
  arrivalCode = "CPH",
  arrivalCity = "Copenhagen",
  arrivalTime = "15:05",
  gate = "B12",
  boardingTime = "10:05",
  seat = "14A",
  boardingGroup = "2",
  date = "Thu, 12 Nov",
  notice = "Doors close 15 min before departure",
  passenger = "Maya Chen",
  passCode = "NW0214-LISCPH-14A",
  headingLevel = 3,
  class: className,
} = Astro.props;

const Heading = ({ 2: "h2", 3: "h3", 4: "h4" } as const)[headingLevel];

// Deterministic high-contrast barcode bars derived from passCode.
const bars: { x: number; w: number }[] = [];
let cursor = 2;
const seed = passCode.length ? passCode : "NW0214";
let idx = 0;
while (cursor < 224) {
  const code = seed.charCodeAt(idx % seed.length) + idx * 17;
  const w = (code % 3) + 1.5;
  const gap = ((code >> 2) % 3) + 1.5;
  if (cursor + w <= 228) bars.push({ x: cursor, w });
  cursor += w + gap;
  idx++;
}
---

<article
  class={cn(
    "flex w-full max-w-[440px] min-w-0 flex-col overflow-hidden rounded-2xl border border-border bg-card text-card-foreground shadow-lift",
    className,
  )}
>
  <header class="flex flex-wrap items-center justify-between gap-2 px-4 pt-4 pb-3 sm:px-5">
    <div class="flex min-w-0 items-center gap-2">
      <Compass aria-hidden="true" class="size-4 shrink-0 text-muted-foreground" />
      <Heading class="truncate text-sm/5 font-semibold tracking-tight text-foreground">{airline}</Heading>
      <span class="shrink-0 text-xs/4 font-medium text-muted-foreground tabular-nums">{flightNumber}</span>
    </div>
    <span class="inline-flex shrink-0 items-center rounded-md bg-success/14 px-2 py-0.5 text-xs/4 font-medium text-success">
      {status}
    </span>
  </header>

  <div class="grid grid-cols-[minmax(0,1fr)_minmax(2.25rem,0.55fr)_minmax(0,1fr)] items-center gap-2 px-4 py-2 sm:gap-3 sm:px-5">
    <div class="min-w-0">
      <p class="text-2xl/7 font-bold tracking-tight text-foreground sm:text-3xl/9">{departureCode}</p>
      <p class="mt-0.5 text-xs/4 text-muted-foreground tabular-nums">
        <span class="block sm:inline">{departureCity}</span><span class="hidden sm:inline"> · </span><span class="block sm:inline">{departureTime}</span>
      </p>
    </div>

    <div class="flex items-center gap-1.5" aria-hidden="true">
      <span class="h-px flex-1 border-t border-dashed border-border-strong"></span>
      <Plane class="size-4 shrink-0 text-muted-foreground" />
      <span class="h-px flex-1 border-t border-dashed border-border-strong"></span>
    </div>

    <div class="min-w-0 text-end">
      <p class="text-2xl/7 font-bold tracking-tight text-foreground sm:text-3xl/9">{arrivalCode}</p>
      <p class="mt-0.5 text-xs/4 text-muted-foreground tabular-nums">
        <span class="block sm:inline">{arrivalTime}</span><span class="hidden sm:inline"> · </span><span class="block sm:inline">{arrivalCity}</span>
      </p>
    </div>
  </div>

  <dl class="grid grid-cols-4 gap-1.5 px-4 py-3 sm:gap-2 sm:px-5">
    <div class="grid min-w-0 gap-0.5">
      <dt class="truncate text-[0.6875rem]/4 text-muted-foreground">Gate</dt>
      <dd class="truncate text-xs/4 font-semibold text-foreground tabular-nums sm:text-sm/5">{gate}</dd>
    </div>
    <div class="grid min-w-0 gap-0.5">
      <dt class="truncate text-[0.6875rem]/4 text-muted-foreground">Boards</dt>
      <dd class="truncate text-xs/4 font-semibold text-foreground tabular-nums sm:text-sm/5">{boardingTime}</dd>
    </div>
    <div class="grid min-w-0 gap-0.5">
      <dt class="truncate text-[0.6875rem]/4 text-muted-foreground">Seat</dt>
      <dd class="truncate text-xs/4 font-semibold text-foreground tabular-nums sm:text-sm/5">{seat}</dd>
    </div>
    <div class="grid min-w-0 gap-0.5">
      <dt class="truncate text-[0.6875rem]/4 text-muted-foreground">Group</dt>
      <dd class="truncate text-xs/4 font-semibold text-foreground tabular-nums sm:text-sm/5">{boardingGroup}</dd>
    </div>
  </dl>

  <p class="px-4 pb-3 text-xs/4 text-muted-foreground tabular-nums sm:px-5">
    {date} · {notice}
  </p>

  <div class="relative flex h-5 items-center" aria-hidden="true">
    <span class="absolute -left-2.5 size-5 rounded-full border border-frame bg-background"></span>
    <span class="mx-2.5 h-px flex-1 border-t border-dashed border-border-strong"></span>
    <span class="absolute -right-2.5 size-5 rounded-full border border-frame bg-background"></span>
  </div>

  <footer class="flex items-center justify-between gap-3 px-4 py-4 sm:gap-4 sm:px-5">
    <svg
      aria-hidden="true"
      viewBox="0 0 230 44"
      preserveAspectRatio="none"
      class="h-11 min-w-0 max-w-[230px] flex-1 text-foreground"
    >
      {bars.map(({ x, w }) => (
        <rect x={x} y="2" width={w} height="40" rx="0.5" fill="currentColor" />
      ))}
    </svg>
    <div class="grid shrink-0 justify-items-end gap-0.5 text-end">
      <span class="text-[0.6875rem]/4 text-muted-foreground">Passenger</span>
      <span class="text-xs/4 font-semibold text-foreground sm:text-sm/5">{passenger}</span>
      <span class="text-[0.6875rem]/4 text-muted-foreground tabular-nums">{date}</span>
    </div>
  </footer>
</article>
```
