# Calendar

A month grid to pick a date or a range, with markers, unavailable days and several visible months.

- Family: date
- Import: `import { Calendar } from "@senvenli/react/date";`
- Page: https://design.senvenli.com/docs/components/calendar
- JSON: https://design.senvenli.com/docs/components/calendar.json

## Example: A chosen day

The selected day sets the month that opens.

```tsx
import { CalendarDate } from "@internationalized/date";
import { Calendar } from "@senvenli/react/date";

export default function Example() {
  return <Calendar aria-label="Delivery day" defaultValue={new CalendarDate(2026, 3, 18)} />;
}
```

## Examples

### This month

No value: it opens on the visitor's month, so it renders in the browser only.

```tsx
import { Calendar } from "@senvenli/react/date";
import { ClientOnly } from "../../lib/client-only";

/** A bare Calendar opens on today's month, which a prerendered page cannot know: render it after mount. */
export default function Example() {
  return <ClientOnly minHeight={326}>{() => <Calendar aria-label="This month" />}</ClientOnly>;
}
```

## Guidelines

### When to use it

- Showing availability or picking dates in place, without a field.

### Use something else when

- [date-picker](https://design.senvenli.com/docs/components/date-picker.md): A form field opens the calendar.

## Accessibility

Keyboard:

- Arrow keys: Moves between days.
- Page Up / Page Down: Moves a month.

Built in:

- Each day is announced with its markers and why it is unavailable.
- Month and weekday names follow the locale.

You provide:

- A label for the calendar.

## API reference

### Calendar

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| minValue | `CalendarDate` |  | no |  |
| maxValue | `CalendarDate` |  | no |  |
| isDateUnavailable | `(date: CalendarDate) => boolean` |  | no | Days that cannot be picked; they stay focusable and say why (`unavailableReason`). |
| unavailableReason | `(date: CalendarDate) => string \| undefined` |  | no | Why a day is unavailable ("Closed", "Sold out"); read with the day. |
| locale | `string` |  | no | Locale override; the DesignSystemProvider locale by default. Month and weekday names come from Intl. |
| firstDayOfWeek | `FirstDayOfWeek` |  | no | Overrides the locale's first day of the week. |
| timeZone | `string` |  | no | The time zone "today" is computed in (the location's); the device's by default. |
| aria-label | `string` |  | no | Names the calendar ("Start date"). |
| defaultFocusedValue | `CalendarDate` |  | no | The month that opens while nothing is chosen (any day in it). A prerendered page passes a fixed one, so the HTML does not depend on the build day; left out, the month of "today" (in `timeZone` when given). |
| value | `CalendarDate \| DateRange` |  | no |  |
| defaultValue | `CalendarDate \| DateRange` |  | no |  |
| onChange | `(value: CalendarDate) => void \| (value: DateRange) => void` |  | no |  |
| getDateMarkers | `(date: CalendarDate) => DateMarker \| undefined` |  | no | A dot under a day (events on it); a string is also said to screen readers. |
| visibleMonths | `1 \| 2` |  | no |  |
| selectionMode | `"single" \| "range"` |  | no | `single` (default): one day. |
| allowsNonContiguousRanges | `boolean` |  | no | Keep this false when a range may not cross an unavailable day (stays, trips, equipment hire). |
| minDuration | `number` |  | no | Shortest and longest range in days (end − start). |
| maxDuration | `number` |  | no |  |
| action | `React.ReactNode` |  | no | In a popover: the footer shows the chosen range and its length beside this action ("Apply dates"). |

### Tokens it reads

`--ds-background-brand-bold`, `--ds-background-brand-bold-hovered`, `--ds-background-neutral-subtle-hovered`, `--ds-background-selected`, `--ds-background-selected-hovered`, `--ds-border`, `--ds-border-focused`, `--ds-border-selected`, `--ds-icon`, `--ds-icon-brand`, `--ds-radius-control-medium`, `--ds-radius-full`, `--ds-radius-large`, `--ds-radius-small`, `--ds-shadow-raised`, `--ds-size-control`, `--ds-size-control-compact`, `--ds-space-050`, `--ds-space-100`, `--ds-space-150`, `--ds-space-200`, `--ds-space-400`, `--ds-surface-raised`, `--ds-text`, `--ds-text-disabled`, `--ds-text-on-brand`, `--ds-text-subtle`, `--ds-text-subtlest`

## Related

- [date-picker](https://design.senvenli.com/docs/components/date-picker.md)
