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

# Month and year list

A month list or a year list in a month's caption, for a far date such as a date of birth, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `DatePickerCaptionList`.

## Try it

Open the picker and choose a day, a range, any time, a repeat (weekdays or a day of the month) or a quick “soon” choice, or type one (“17 nov”, “1 dec - 5 dec”) and press Enter. The button says it in words; the line under it says what a form would keep.

Nothing is saved; the line only shows what the choice holds.

## When to use

- A month list or a year list in a month's caption, for a far date such as a date of birth.

## 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 Month and year list 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>/meadow-date-picker-choices.json --yes
```

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

## Usage

```tsx
import { datePickerRepeatWords, datePickerSoonRange, parseDatePickerDay, parseDatePickerRange, DatePickerAnyPanel, DatePickerRecurringPanel } from '@/components/ui/goop/date-picker-choices';

import { useState } from 'react';
import { Calendar } from '@/components/ui/goop/calendar';
import {
  DatePickerCaptionList,
  type DatePickerChoice,
  DatePickerSoonPanel,
  datePickerChoiceWords,
} from '@/components/ui/goop/date-picker-choices';

function BirthAndDue() {
  const [due, setDue] = useState<DatePickerChoice>();
  return (
    <div className="flex flex-col gap-4">
      <Calendar
        aria-label="Date of birth"
        captionList={DatePickerCaptionList}
        minDate={new Date(1920, 0, 1)}
        maxDate={new Date()}
      />
      <DatePickerSoonPanel
        value={due?.mode === 'soon' ? due.key : null}
        onValueChange={(_key, choice) => setDue(choice)}
      />
      <p className="text-sm text-muted-foreground">{datePickerChoiceWords(due) || 'No due date'}</p>
    </div>
  );
}
```

- Fits: flow, settings: field.
- width, padding, gap, background, text: add no class for these.

## API reference

### Options

- `Defaults: options = []`

- Types: DatePickerRepeat = { every: 'day' } | { every: 'week'; weekdays: number[] } | { every: 'month'; day: number }; DatePickerSoonKey = 'today' | 'tomorrow' | 'this-week' | 'next-week' | 'this-month'

### Parts

- `DatePickerAnyPanel` — The panel for leaving the date open, one line of words; children replace the default sentence
- `DatePickerRecurringPanel` — The panel for a repeating date, daily, weekly or monthly; value and onValueChange hold the repeat; value?: DatePickerRepeat — The repeat shown, held by the page with `onValueChange`; defaultValue?: DatePickerRepeat — The repeat shown first when the panel holds its own; onValueChange?: (value: DatePickerRepeat) => void — Called with the repeat as each control leaves it
- `DatePickerSoonPanel` — The panel of quick choices, Today to This month; value is the chosen key, onValueChange hears a pick; value?: 'today' | 'tomorrow' | 'this-week' | 'next-week' | 'this-month' | null — The chosen quick choice, `null` for none, held by the page with `onValueChange`; defaultValue?: 'today' | 'tomorrow' | 'this-week' | 'next-week' | 'this-month' — The quick choice chosen first when the panel holds its own; onValueChange?: (value: 'today' | 'tomorrow' | 'this-week' | 'next-week' | 'this-month', choice: Extract<DatePickerChoice, { mode: 'soon' }>) => void — Called with the quick choice pressed (or chosen with Enter), and the choice with its days counted from `today`; today?: Date — The date the choices count from; the clock's if left out
- `datePickerRepeatWords` — A repeat in words
- `datePickerSoonRange` — The days a quick choice stands for, counted from `today`
- `datePickerChoiceWords` — A choice in words, as the layer's field shows it
- `parseDatePickerDay` — A day typed in the field, read leniently
- `parseDatePickerRange` — A range typed in the field

## Keyboard

- ArrowLeft / ArrowRight: move between the five tabs, each opening its panel
- Tab: move from the tabs into the panel: the repeat's list, each weekday toggle, the day's list, or the quick choices' list; on the Day tab the caption's month and year lists, then the month
- Space / Enter on a weekday: press or release that day of a weekly repeat
- ArrowUp / ArrowDown in the quick choices: move between the quick choices; Enter chooses the one reached
- Escape: close the layer; the focus returns to what opened it

## Accessibility

- The part itself answers the keys above.
- pressed: the attribute aria-pressed

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

Shortened to fit: the data-slot values.

## Related

- [Calendar](/themes/meadow/components/calendar): A month always in view, to choose a date or a range of dates.
- [Date range picker](/themes/meadow/components/date-range-picker): A field that opens a calendar to choose a range of dates, with presets beside it when given.
- [Time picker](/themes/meadow/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/meadow/components/wizard): A flow the user goes through one step at a time, with back and next buttons.
