# FlightItinerary

> A journey of one or more legs: the title, stop count and total duration over the whole trip on one line, then a native `<details>` whose toggle lists every leg with the layovers between them.

```ts
import { FlightItinerary } from "@sdxc/ui/travel";
```

Renders the journey: a `<section>` with the title, stop count and total duration over the trip
on one FlightRoute line, then a `<details>` whose `<summary>` is the toggle and whose
body is an ordered list of legs and layovers, so the legs open and close with no script.

## Examples

```tsx
<FlightItinerary title="Outbound · Fri 14 Mar" airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
	arrival={{ time: "18:20", code: "OSK" }} duration="9h 40m" stops={1} stopsLabel="1 stop" toggleLabel="Flight details">
	<FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 214" … />
	<FlightItinerary.Layover>1h 35m layover in VLS Vellis</FlightItinerary.Layover>
	<FlightItinerary.Segment airline="Larkwing Air" flightNumber="LW 731" … />
</FlightItinerary>
```

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `title?` | `RemixNode` | What the journey is, such as "Outbound · Fri 14 Mar", over the summary line. |
| `airline?` | `RemixNode` | Who flies it, such as "Larkwing Air" or "Larkwing Air, Fenwick Connect". |
| `departure` | `FlightRoute.Endpoint` | Where the whole journey starts. |
| `arrival` | `FlightRoute.Endpoint` | Where the whole journey ends. |
| `duration` | `RemixNode` | The whole journey's duration, layovers included, such as "9h 40m". |
| `stops?` | `number` | How many stops the summary line draws. |
| `stopsLabel?` | `RemixNode` | The stop count as words, such as "Nonstop" or "1 stop". |
| `dayOffset?` | `string` | The badge after the final arrival time, such as "+1". |
| `dayOffsetLabel?` | `string` | What the day badge means, read in its place. |
| `labels?` | `FlightRoute.Labels` | Hidden words that make the summary line a sentence; see FlightRoute.Labels. |
| `toggleLabel` | `RemixNode` | The words on the disclosure's toggle, such as "Flight details". |
| `open?` | `boolean` | Starts with every leg showing. |
| `children` | `RemixNode` | The FlightItinerary.Segment and FlightItinerary.Layover items, in order. |

Also accepts everything in `Omit<TagProps<"section">, "title">`.


### FlightItinerary.Segment

Renders one leg of the journey as a list item holding a FlightSegment.

Also accepts everything in `FlightSegment.Props`.


### FlightItinerary.Layover

Renders the connection between two legs as a tinted row with a glyph, the caller's words and an optional note.

| Prop | Type | Description |
| --- | --- | --- |
| `children` | `RemixNode` | The connection in words, such as "1h 35m layover in VLS Vellis". |
| `note?` | `RemixNode` | A second line, such as "Overnight · change terminals". |
| `tone?` | `"default" \| "warning"` |  |
| `icon?` | `RemixNode` | A glyph before the words; a clock, or an alert for a warning, when left out. |

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


## Types

| Name | Values | What it decides |
| --- | --- | --- |
| `LayoverTone` | `"default" \| "warning"` | `"warning"` flags a connection worth a second look: a short one, an overnight one. |
