nook
Browse the docs

Components

Calendar

Native

A month of days to choose one day or a range from.

See the prompt
November 2026
SuMoTuWeThFrSa

Installation

npx nook-ui@latest add calendar

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Calendar" component to this project, exactly as Nook ships it.

A month of days to choose one day or a range from.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add calendar`. It writes `components/ui/calendar.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/calendar.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

```tsx
import { Calendar } from "@/components/ui/calendar";

export default function CalendarDefault() {
  return <Calendar defaultValue={new Date(2026, 10, 18)} min={new Date(2026, 10, 3)} />;
}
```

API
- `Calendar`: The month and its controls.
  - `mode` (`"single" | "range"`, default "single"): Choose one day, or a first and a last day.
  - `value` (`Date | null | DateRange`): Controlled value. In range mode: `{ from, to }`.
  - `defaultValue` (`Date | null | DateRange`): Initial value when uncontrolled.
  - `onValueChange` (`(value) => void`): Called when a day is chosen.
  - `month` (`Date`): The month on screen, when controlled.
  - `defaultMonth` (`Date`): The month shown first.
  - `min` (`Date`): Days before this cannot be chosen.
  - `max` (`Date`): Days after this cannot be chosen.
  - `isDateDisabled` (`(date: Date) => boolean`): Return true for days that cannot be chosen.
  - `weekStartsOn` (`0 | 1`, default 0): 0 starts the week on Sunday, 1 on Monday.
  - `locale` (`string`, default "en-US"): Locale for month and weekday names.

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: A grid of days. Arrow keys move by day and week, Home and End go to the ends of the week, Page Up and Page Down change month (with Shift, year). Each day is announced with its full date; today and the chosen days are marked.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

import { Calendar } from "@/components/ui/calendar";

export default function CalendarDefault() {
  return <Calendar defaultValue={new Date(2026, 10, 18)} min={new Date(2026, 10, 3)} />;
}

Examples

A range

Press a first day, then a last day. The week starts on Monday here.

November 2026
MoTuWeThFrSaSu

Disabled days and limits

June 2026
MoTuWeThFrSaSu

Weekdays only, within a month.

Another language

abril de 2026
lumamijuvisádo

Booking range

August 2026
SuMoTuWeThFrSa

5 nights · the 15th is booked

Props

Calendar

The month and its controls.

PropTypeDefaultDescription
mode"single" | "range""single"Choose one day, or a first and a last day.
valueDate | null | DateRange–Controlled value. In range mode: `{ from, to }`.
defaultValueDate | null | DateRange–Initial value when uncontrolled.
onValueChange(value) => void–Called when a day is chosen.
monthDate–The month on screen, when controlled.
defaultMonthDate–The month shown first.
minDate–Days before this cannot be chosen.
maxDate–Days after this cannot be chosen.
isDateDisabled(date: Date) => boolean–Return true for days that cannot be chosen.
weekStartsOn0 | 100 starts the week on Sunday, 1 on Monday.
localestring"en-US"Locale for month and weekday names.

Accessibility

A grid of days. Arrow keys move by day and week, Home and End go to the ends of the week, Page Up and Page Down change month (with Shift, year). Each day is announced with its full date; today and the chosen days are marked.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.