FlightOption
One row of flight search results.
View code
<FlightOption
aria-label="Larkwing Air, $412"
price="$412"
priceDetail="Round trip per person"
badges={<Badge color="success" variant="secondary">Cheapest</Badge>}
action={<Button type="submit" name="option" value="lw-214">Select</Button>}
featured
>
<FlightOption.Journey airline="Larkwing Air" departure={{ time: "08:40", code: "MRW" }}
arrival={{ time: "10:55", code: "VLS" }} duration="2h 15m" stopsLabel="Nonstop" />
<FlightOption.Journey airline="Larkwing Air" departure={{ time: "22:10", code: "VLS" }}
arrival={{ time: "06:05", code: "MRW" }} duration="7h 55m" stops={1}
stopsLabel="1 stop · OSK" dayOffset="+1" dayOffsetLabel="arrives the next day" />
</FlightOption>Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { FlightOption } from "@sdxc/ui/travel";Renders the row as an <article>: badges, then each FlightOption.Journey, then the
price, its detail and the action. A list of these, each in an <li>, makes a results page;
name each one with aria-label (such as "Larkwing Air, $412") so a list reads at a glance.
Composition
The parts the component publishes, each a static property of the host.
FlightOptionFlightOption.JourneyRenders one direction of the trip as a list item: the airline's mark and name over the FlightRoute, so outbound and return lines stack with their routes aligned.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
price | RemixNode | Yes | The fare, formatted by the caller, such as "$412". |
priceDetail | RemixNode | No | What the fare covers, such as "Round trip per person", under the price. |
badges | RemixNode | No | Labels over the journeys, such as <Badge> elements reading "Cheapest" or "Fastest". |
action | RemixNode | No | The select link or submit button, at the price's end. |
featured | boolean | No | Rings the row in the brand colour, for the option a page recommends. |
details | RemixNode | No | Full detail under the row, such as a FlightItinerary per journey. |
children | RemixNode | Yes | The FlightOption.Journey lines, one per direction. |
Also accepts everything in TagProps<"article">.
FlightOption.Journey
| Prop | Type | Required | Description |
|---|---|---|---|
airline | RemixNode | Yes | The airline or airlines, such as "Larkwing Air". |
mark | RemixNode | No | The airline's mark, drawn in a 1.75rem square before the route. |
Also accepts everything in Omit<TagProps<"li">, "children">.
Also accepts everything in RouteProps.
Types
| Name | Values | What it decides |
|---|---|---|
RouteProps | "departure" | "arrival" | "duration" | "stops" | "stopsLabel" | "dayOffset" | "dayOffsetLabel" | The route's ends and what lies between them; see FlightRoute. |