FareCalendar
A flexible-dates fare calendar.
March 2026
View code
<FareCalendar
variant="strip"
days={["2026-03-06", "2026-03-07", …, "2026-03-14"]}
fares={fares}
selected="2026-03-10"
href={(day) => `?depart=${day}`}
prevHref="?depart=2026-03-03"
nextHref="?depart=2026-03-17"
locale="en-US"
label="Nearby dates"
labels={labels}
/>
<FareCalendar
month="2026-03"
fares={fares}
selected="2026-03-10"
today="2026-03-02"
href={(day) => `?depart=${day}`}
prevHref="?month=2026-02"
nextHref="?month=2026-04"
locale="en-US"
label="Departure dates"
labels={labels}
/>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 { FareCalendar } from "@sdxc/ui/travel";Renders a month <table> with previous and next links, or, as "strip", a <nav> named by
label around a scrolling row of day cards. A day with a fare links to href(day), named by
its full date, fare and, at the "low" level, labels.cheapest; a day without one is text.
Examples
<FareCalendar variant="strip" days={week} fares={fares} selected={day} href={href} locale={locale} label="Nearby dates" labels={labels} />Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
variant | "month" | "strip" | No | "strip" draws days as one scrolling row instead of a month grid. @default "month" |
month | string | No | The month the grid shows, YYYY-MM; the strip ignores it. |
days | string[] | No | The days the strip shows, YYYY-MM-DD, usually a few either side of selected. |
fares | Record<string, Fare | undefined> | Yes | Each day's lowest fare by YYYY-MM-DD; a missing or undefined entry means no flights. |
selected | string | No | The chosen day, YYYY-MM-DD, marked as the current page and scrolled into the strip's view. |
href | (day: string) => string | Yes | Builds the URL a day links to. |
prevHref | string | No | The previous link's URL; the link is left out when unset. |
nextHref | string | No | The next link's URL; the link is left out when unset. |
today | string | No | Today, YYYY-MM-DD, passed in so the server and the browser draw the same marker. |
weekStartsOn | number | No | First weekday column, 0 for Sunday through 6 for Saturday. @default 0 |
locale | string | Yes | BCP 47 locale for the month, weekday and day names; server and browser must agree on it. |
label | string | Yes | Names the whole calendar, e.g. "Departure dates". |
headingLevel | Heading.Level | No | Level of the month's heading; resolved from the surrounding heading scope when unset. |
labels | Labels | Yes |
Also accepts everything in Omit<TagProps<"div">, "children">.
Types
| Name | Values | What it decides |
|---|---|---|
Level | "low" | "mid" | "high" | How a day's fare compares with the others on view; "low" marks the cheapest. |