SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

FareCalendar

A flexible-dates fare calendar.

View code
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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

tsx
<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.

PropTypeRequiredDescription
variant"month" | "strip"No"strip" draws days as one scrolling row instead of a month grid. @default "month"
monthstringNoThe month the grid shows, YYYY-MM; the strip ignores it.
daysstring[]NoThe days the strip shows, YYYY-MM-DD, usually a few either side of selected.
faresRecord<string, Fare | undefined>YesEach day's lowest fare by YYYY-MM-DD; a missing or undefined entry means no flights.
selectedstringNoThe chosen day, YYYY-MM-DD, marked as the current page and scrolled into the strip's view.
href(day: string) => stringYesBuilds the URL a day links to.
prevHrefstringNoThe previous link's URL; the link is left out when unset.
nextHrefstringNoThe next link's URL; the link is left out when unset.
todaystringNoToday, YYYY-MM-DD, passed in so the server and the browser draw the same marker.
weekStartsOnnumberNoFirst weekday column, 0 for Sunday through 6 for Saturday. @default 0
localestringYesBCP 47 locale for the month, weekday and day names; server and browser must agree on it.
labelstringYesNames the whole calendar, e.g. "Departure dates".
headingLevelHeading.LevelNoLevel of the month's heading; resolved from the surrounding heading scope when unset.
labelsLabelsYes

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

Types

NameValuesWhat it decides
Level"low" | "mid" | "high"How a day's fare compares with the others on view; "low" marks the cheapest.
@sdxc/ui

Can’t find it? Contact us