SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

RangeMonths

A server-rendered run of consecutive month grids for picking a stay's check-in and check-out, or a single date.

View code
tsx
<RangeMonths
	label="Stay dates"
	labels={{ previous: "Previous month", next: "Next month", start: "check-in", end: "check-out" }}
	locale="en-US"
	month={query.month ?? "2026-09"}
	start={query.checkIn}
	end={query.checkOut}
	today={today}
	min={today}
	isUnavailable={(date) => booked.has(date)}
	dayNote={(date) => `$${nightlyPrice(date)}`}
	href={({ start, end, month }) =>
		`?${new URLSearchParams({ month, ...(start && { checkIn: start }), ...(end && { checkOut: end }) })}`
	}
/>

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";

Or copy it into your project to edit it:

Terminal
sdxc ui add range-months

Usage

typescript
import { RangeMonths } from "@sdxc/ui";

Renders months month grids from month, each day a link to href's URL for the selection a click makes: with no start, or both ends set, the day becomes a new start; with only a start, a later day becomes the end and an earlier or equal one the new start. Single mode links each day as { start: day }. Unavailable days, days outside min–max, and, while a start waits for its end, days past the first unavailable day after it render as plain text.

Examples

tsx
<RangeMonths single months={1} label={t("jump")} labels={labels} month="2026-03" start={day} today={today} href={({ start, month }) => `/day/${start ?? month}`} />

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
monthstringYesFirst month shown, YYYY-MM.
monthsnumberNoHow many consecutive months to show, side by side while they fit and one per row below. Defaults to DEFAULT_MONTHS.
startstringNoChosen start day (the picked day in single mode), YYYY-MM-DD.
endstringNoChosen end day, YYYY-MM-DD; read in range mode only.
singlebooleanNoPicks one day: a day link carries start alone and no band is drawn.
todaystringNoToday, YYYY-MM-DD, passed in so the server and the browser draw the same marker.
minstringNoEarliest selectable day, YYYY-MM-DD; also hides the previous link before its month.
maxstringNoLatest selectable day, YYYY-MM-DD; also hides the next link from its month on.
isUnavailable(date: string) => booleanNoDays already taken: drawn struck through, never a link, and never crossed by a range.
href(next: Next) => stringYesBuilds the URL of every day and month link from what that link selects.
dayNote(date: string) => RemixNodeNoA small line under each day's number, such as the nightly price or event dots.
weekStartsOnnumberNoFirst weekday column, 0 for Sunday through 6 for Saturday. Defaults to DEFAULT_WEEK_STARTS_ON.
localestringNoBCP 47 locale for the month, weekday and day names; pass it so server and browser agree.
labelstringYesNames the whole calendar, e.g. "Stay dates".
headingLevelHeading.LevelNoLevel of each month's heading; resolved from the surrounding heading scope when unset.
labelsLabelsYesWords read to assistive technology.

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

@sdxc/ui

Can’t find it? Contact us