---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Calendar

A month always in view, to choose a date or a range of dates, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Calendar`.

## Try it

Pick a look. Month: pick a delivery day; past days, Sundays and one closing day are refused. Range and Two months: pick a start, point at a later day to see the band it would make, and pick its end. Rules: a booking of two to six nights that never crosses the closed day. Dropdowns: a date of birth, decades back through the caption’s month and year lists. The arrows move by day, PageUp and PageDown by month.

Nothing is delivered or booked; the closing days are our own, counted from today.

## When to use

- A month always in view, to choose a date or a range of dates.
- Also called: month view or date grid.

## When not to use

- For a field that opens on a press, use DatePicker or DateRangePicker.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Calendar on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-calendar.json --yes
```

```text
Add the Goop Calendar to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Calendar } from '@/components/ui/goop/calendar';
import { useState } from 'react';

function StayCalendar() {
  const [stay, setStay] = useState<{ from: Date | undefined; to?: Date | undefined } | null>(null);
  return (
    <Calendar
      aria-label="Stay"
      mode="range"
      numberOfMonths={2}
      minDate={new Date()}
      minNights={2}
      maxNights={14}
      disabledDays={[new Date(2026, 11, 24)]}
      value={stay}
      onValueChange={setStay}
    />
  );
}
```

- Fits: schedule, flow: aside.
- height, width, corner, border, background, text: add no class for these.

## API reference

### Options

- `disabled?: boolean` — Whether the calendar is disabled: every day refused, both paging buttons held.
- `mode?: 'single' | 'range' = 'single'` — One date is chosen at a time. Or: A range: a first press its start, a second its end, a third starts over.
- `value?: Date | null | DatePickerRange | null` — The chosen date, when the caller holds it (`null` for none); with `onValueChange`. Or: The chosen range, when the caller holds it.
- `defaultValue?: Date | DatePickerRange` — The date chosen at first, when the calendar holds it. Or: The range chosen at first, when the calendar holds it.
- `onValueChange?: ((value: Date | null) => void) | ((value: DatePickerRange | null) => void)` — Called with the date chosen, or `null` when it is pressed again. Or: Called with the range after each press (`to` undefined until its end is chosen), or `null` for none.
- `minNights?: number` — The fewest nights a range spans; a shorter one starts over.
- `maxNights?: number` — The most nights a range spans; a longer one starts over at the pressed date.
- `allowDisabledInRange?: boolean` — Let a range cross days that cannot be chosen (its ends still can't be one).

- Takes every prop of DatePickerPanel but dayClassName, cellClassName and headClassName (its page: date-picker.md)
- Another example of it: date-picker-choices.md
- State: value (value / defaultValue / onValueChange); drawn by data-selected, data-outside-month, data-disabled
- Types: DatePickerRange = { from: Date | undefined; to?: Date | undefined }

## Keyboard

- ArrowLeft / ArrowRight: move to the day before or after (the other way in right-to-left)
- ArrowUp / ArrowDown: move a week back or on
- Home / End: move to the first or last day of the week
- PageUp / PageDown: move a month back or on, paging the month
- Shift+PageUp / Shift+PageDown: move a year back or on
- Shift+ArrowUp / Shift+ArrowDown / Shift+ArrowLeft / Shift+ArrowRight: move a year (up or down) or a month (left or right)
- Enter / Space: choose the focused day

## Accessibility

- The part itself answers the keys above.
- hover, focus-visible: the browser's own (:hover, :focus-visible): write nothing
- selected: the attribute data-selected
- outside-month: the attribute data-outside-month
- disabled: the attribute data-disabled

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Date picker](/themes/trail/components/date-picker): A field that opens a calendar to choose one date, typed or picked.
- [Date range picker](/themes/trail/components/date-range-picker): A date range field that opens a calendar to choose a start and an end date, with presets such as the last 7 days beside it when given.
- [Month and year list](/themes/trail/components/date-picker-choices): A month list or a year list in a month's caption, for a far date such as a date of birth.
- [Time picker](/themes/trail/components/time-picker): A field for a time of day that a person types or picks from a list, such as a meeting's start.
