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

# 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, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `DateRangePicker`.

## Try it

Pick a stay of two to fourteen nights from today on (a shorter or longer one is refused, past days are closed); pick a report period from a preset or the months; clear either. The line under each field says while its months are open.

Nothing is booked or fetched: the lines under the fields only read the choice.

## When to use

- 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.
- Also called: date range input.

## 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 Date range picker 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-date-range-picker.json --yes
```

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

## Usage

```tsx
import { commonDateRangePresets, DateRangePicker } from '@/components/ui/goop/date-range-picker';

<DateRangePicker aria-label="Period" name="period" presets={commonDateRangePresets()} maxDate={new Date()} />
```

- Fits: overview (its recipe); overview, list: toolbar (time: span).
- width, padding, gap, corner, border, text: add no class for these.

## API reference

### Parts

- `commonDateRangePresets` — The six presets a report's filter most often offers, counted from `today` (the clock's if left out)

- data-slot values (to select a part by): date-range-picker, date-range-picker-body, date-range-picker-presets, date-range-picker-value

### DateRangePicker: every option

```tsx
import { DateRangePicker } from '@/components/ui/goop/date-range-picker';
```

### Options

- id?: string — The trigger's id: a `Field` hands it, so its label names the trigger.
- aria-label?: string — The field's name, said before the chosen dates ("Stay: 12 Nov – 19 Nov 2026"), and the layer's.
- value?: DatePickerRange | null — The chosen range, when the caller holds it.
- defaultValue?: DatePickerRange — The range chosen at first, when the field holds it.
- onValueChange?: (value: DatePickerRange | null) => void — Called with a whole range once its end or a preset is chosen, or `null` when cleared.
- name?: string — The form fields' name: `<name>-from` and `<name>-to` are sent as `YYYY-MM-DD`.
- placeholder?: string = 'Pick dates' — The trigger's words while no range is chosen.
- format?: (range: DatePickerRange) => string — Writes the chosen range in the trigger; "12 Nov – 19 Nov 2026" if left out.
- locale?: string — The language of the trigger's words and the months (a BCP 47 tag; the page's, else the browser's, if left out).
- presets?: DateRangePreset[] — The presets listed beside the months; none if left out.
- open?: boolean — Whether the layer is open, when the caller holds it; with `onOpenChange`.
- defaultOpen?: boolean = false — Whether the layer is open at first.
- onOpenChange?: (open: boolean) => void — Called as the layer opens or closes.
- container?: HTMLElement | null — Where the layer is portalled; the end of `<body>` when left out.
- minDate?: Date — The first date that can be chosen; the months page back no further.
- maxDate?: Date — The last date that can be chosen; the months page on no further.
- disabled?: boolean — Whether the field is disabled: the trigger dimmed and skipped by Tab, nothing sent with the form.
- disabledDays?: DatePickerMatcher | DatePickerMatcher[] — The days that cannot be chosen; a range never crosses one unless `allowDisabledInRange`.
- minNights?: number — The fewest nights a range spans.
- maxNights?: number — The most nights a range spans.
- allowDisabledInRange?: boolean — Let a range cross days that cannot be chosen.
- weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 — The weekday a week starts on, 0 for Sunday to 6 for Saturday.
- today?: Date — The date marked as today; the clock's if left out.
- clearLabel?: string = 'Clear dates' — The clear button's spoken name.
- presetsLabel?: string = 'Presets' — The presets list's spoken name.
- State: value (value / defaultValue / onValueChange); open (open / defaultOpen / onOpenChange); drawn by data-placeholder
- Types: DatePickerRange = { from: Date | undefined; to?: Date | undefined }; DateRangePreset = { label: string; range: DatePickerRange }; DatePickerMatcher = Matcher

## Keyboard

- Enter / Space: open the layer from the trigger; on a day, choose it (the first a range's start, the second its end, which closes the layer)
- ArrowLeft / ArrowRight / ArrowUp / ArrowDown: move a day or a week in the months, previewing the range to the day reached
- PageUp / PageDown: move a month back or on
- Shift+PageUp / Shift+PageDown: move a year back or on
- Home / End: move to the first or last day of the week
- ArrowUp / ArrowDown in the presets: move between the presets; Enter chooses one and closes the layer
- Escape: close the layer; the focus returns to the trigger

## Accessibility

- The native element answers the keyboard.
- focus-visible: the browser's own (:focus-visible): write nothing
- disabled: the prop disabled
- placeholder-shown: the attribute data-placeholder

## 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

- [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.
- [Wizard](/themes/trail/components/wizard): A flow the user goes through one step at a time, with back and next buttons.
- [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.
- [Date picker](/themes/trail/components/date-picker): A field that opens a calendar to choose one date, typed or picked.
