Skip to content

Calendar

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
Used for
  • Pick a date
  • Review window
  • Release freeze days
  • Booking range
  • Date picker body

Examples

Months

Several days

Controlled month

Installation

npx knowns-ui@latest add calendar
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

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
Default1
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
Defaultfalse / true
Draw the neighbouring months' days (one month only). fixedWeeks keeps six rows so the height never jumps.
weekStartsOn / locale
number / string
Default1 / browser
0 is Sunday. Month and weekday names come from Intl.
autoFocus
boolean
Defaultfalse
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

  1. 01Lays out one or two months, with fixed six-week rows so the grid never jumps height when you page.
  2. 02Selects one day, a range or several days, and previews the range under the pointer before you commit it.
  3. 03Moves by keyboard: arrows, Home, End and Page Up or Down, with Enter or Space to pick, and one tab stop for the grid.
  4. 04Disables days by a function or by min and max, and keeps paging controlled or uncontrolled as you choose.
  5. 05Draws a slot under each date for dots and badges, so deploy days or prices show in the grid.
  6. 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

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

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" }).

Need help?

Stuck on Calendar, or found something off? We read every message.