Components
Calendar
NativeA month of days to choose one day or a range from.
November 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
Installation
npx nook-ui@latest add calendarPrompt
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.
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
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Disabled days and limits
June 2026
| Mo | Tu | We | Th | Fr | Sa | Su |
|---|---|---|---|---|---|---|
Weekdays only, within a month.
Another language
abril de 2026
| lu | ma | mi | ju | vi | sá | do |
|---|---|---|---|---|---|---|
Booking range
August 2026
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|---|---|---|---|---|---|
5 nights · the 15th is booked
Props
Calendar
The month and its controls.
| Prop | Type | Default | Description |
|---|---|---|---|
| mode | "single" | "range" | "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 | 0 | 0 starts the week on Sunday, 1 on Monday. |
| locale | string | "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.