# RangeMonths

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

```ts
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
	label={t("stay.dates")}
	labels={{ previous: t("calendar.previous"), next: t("calendar.next"), start: t("stay.checkIn"), end: t("stay.checkOut") }}
	locale={locale}
	month="2026-03"
	start={query.checkIn}
	end={query.checkOut}
	today="2026-03-02"
	min="2026-03-02"
	isUnavailable={(date) => booked.has(date)}
	dayNote={(date) => `$${prices[date]}`}
	href={(next) => `?${new URLSearchParams({ ...next })}`}
/>
```

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

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `month` | `string` | First month shown, `YYYY-MM`. |
| `months?` | `number` | How many consecutive months to show, side by side while they fit and one per row below. Defaults to DEFAULT_MONTHS. |
| `start?` | `string` | Chosen start day (the picked day in single mode), `YYYY-MM-DD`. |
| `end?` | `string` | Chosen end day, `YYYY-MM-DD`; read in range mode only. |
| `single?` | `boolean` | Picks one day: a day link carries `start` alone and no band is drawn. |
| `today?` | `string` | Today, `YYYY-MM-DD`, passed in so the server and the browser draw the same marker. |
| `min?` | `string` | Earliest selectable day, `YYYY-MM-DD`; also hides the previous link before its month. |
| `max?` | `string` | Latest selectable day, `YYYY-MM-DD`; also hides the next link from its month on. |
| `isUnavailable?` | `(date: string) => boolean` | Days already taken: drawn struck through, never a link, and never crossed by a range. |
| `href` | `(next: Next) => string` | Builds the URL of every day and month link from what that link selects. |
| `dayNote?` | `(date: string) => RemixNode` | A small line under each day's number, such as the nightly price or event dots. |
| `weekStartsOn?` | `number` | First weekday column, 0 for Sunday through 6 for Saturday. Defaults to DEFAULT_WEEK_STARTS_ON. |
| `locale?` | `string` | BCP 47 locale for the month, weekday and day names; pass it so server and browser agree. |
| `label` | `string` | Names the whole calendar, e.g. "Stay dates". |
| `headingLevel?` | `Heading.Level` | Level of each month's heading; resolved from the surrounding heading scope when unset. |
| `labels` | `Labels` | Words read to assistive technology. |

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

