A month grid on its own: one day, a range or several days, one or two months, disabled days, paging you can control, and a slot for dots and badges under each date. Full keyboard navigation. Intl only, no date library. Date Picker and Date Range Picker are built on it.
On this page
- Pick a date
- Review window
- Release freeze days
- Booking range
- Date picker body
Examples
Several days
Controlled month
Installation
npx knowns-ui@latest add calendarPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Calendar from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/calendar
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add calendar
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/calendar/calendar.tsx
- components/ui/knowns/calendar/calendar-utils.ts
- components/ui/knowns/calendar/calendar-zone.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/calendar, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "calendar" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- mode
"range"|"single"|"multiple"- Default
"range" - Range: two clicks. Single: one day, kept in value.from. Multiple: a click adds or removes a day.
- value / onValueChange
DateRange|null, or Date[] when multiple- A range is { from, to? }. onValueChange fires on every click; onComplete (range and single) once the range is complete.
- months
1|2- Default
1 - Months side by side. They stack below 640px.
- month / defaultMonth / onMonthChange
Date / Date / (month: Date) => void- Control the month shown first, or only set where it opens. onMonthChange gets the 1st of the month.
- min / max / isDateDisabled
Date / Date / (d) => boolean- Days that can't be picked: struck through and skipped by the mouse, not by the arrow keys.
- renderDay
(date, { selected, disabled, today, outside }) => ReactNode- Content under the number of each day: dots, a count, a badge. It ignores the pointer, so the day stays one button.
- showOutsideDays / fixedWeeks
boolean / boolean- Default
false / true - Draw the neighbouring months' days (one month only). fixedWeeks keeps six rows so the height never jumps.
- weekStartsOn / locale
number / string- Default
1 / browser - 0 is Sunday. Month and weekday names come from Intl.
- autoFocus
boolean- Default
false - Focus the selected day when mounted, for a calendar inside a popover.
| Prop | Type | Default | Description |
|---|---|---|---|
| mode | "range" | "single" | "multiple" | "range" | Range: two clicks. Single: one day, kept in value.from. Multiple: a click adds or removes a day. |
| value / onValueChange | DateRange | null, or Date[] when multiple | - | A range is { from, to? }. onValueChange fires on every click; onComplete (range and single) once the range is complete. |
| months | 1 | 2 | 1 | Months side by side. They stack below 640px. |
| month / defaultMonth / onMonthChange | Date / Date / (month: Date) => void | - | Control the month shown first, or only set where it opens. onMonthChange gets the 1st of the month. |
| min / max / isDateDisabled | Date / Date / (d) => boolean | - | Days that can't be picked: struck through and skipped by the mouse, not by the arrow keys. |
| renderDay | (date, { selected, disabled, today, outside }) => ReactNode | - | Content under the number of each day: dots, a count, a badge. It ignores the pointer, so the day stays one button. |
| showOutsideDays / fixedWeeks | boolean / boolean | false / true | Draw the neighbouring months' days (one month only). fixedWeeks keeps six rows so the height never jumps. |
| weekStartsOn / locale | number / string | 1 / browser | 0 is Sunday. Month and weekday names come from Intl. |
| autoFocus | boolean | false | Focus the selected day when mounted, for a calendar inside a popover. |
Keyboard: Tab into the grid, then arrows move by day and week, Home and End to the ends of the week, Page Up and Down by month (with Shift, by year); Enter or Space picks. Paging a month nudges the grid in 8px from the side you paged to (180ms); reduced motion swaps it at once. Looking for a date field you can type into? Use Date Picker. For a report period with presets, Date Range Picker.
What it handles
- 01Lays out one or two months, with fixed six-week rows so the grid never jumps height when you page.
- 02Selects one day, a range or several days, and previews the range under the pointer before you commit it.
- 03Moves by keyboard: arrows, Home, End and Page Up or Down, with Enter or Space to pick, and one tab stop for the grid.
- 04Disables days by a function or by min and max, and keeps paging controlled or uncontrolled as you choose.
- 05Draws a slot under each date for dots and badges, so deploy days or prices show in the grid.
- 06Names weekdays, months and every day through Intl in your locale, with no date library and a Monday or Sunday start.
States
- First render
- Nothing. The grid paints as it is
- none
- Month change
- The grid enters 8px from the side you paged to
- 180ms, ease out
- Hover a day
- Background and colour change
- 120ms, ease out
- Select a day
- Background, colour and ring change
- 120ms, ease out
- Month buttons hover
- Background and colour change
- 120ms, ease out
- Reduced motion
- The month swaps with no nudge
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The grid paints as it is | none |
| Month change | The grid enters 8px from the side you paged to | 180ms, ease out |
| Hover a day | Background and colour change | 120ms, ease out |
| Select a day | Background, colour and ring change | 120ms, ease out |
| Month buttons hover | Background and colour change | 120ms, ease out |
| Reduced motion | The month swaps with no nudge | 0ms |
Works with
When to use
When to use
- A month on the page: pick a day, a range or several days, with dots or counts under dates.
- The grid inside your own date field, popover or schedule view.
When not to use
- A date typed into a form field: use Date Picker.
- A report period with presets: use Date Range Picker.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Calendar to my app and wire it to my own data.
- I need a month on the page: pick a day, a range or several days, with dots or counts under dates. Set that up with the Knowns UI Calendar.
- Which Calendar props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "calendar" }) and search_docs({ query: "calendar" }).