Calendar
Pick one day, several or a range from a month of days, or a month or a year from twelve. A pill slides to the pick, a range grows along each week, and each month's name opens a popover of months and years.
Examples
Default
One day, held as a yyyy-mm-dd string. Weekends and bank holidays are unavailable: struck through, still reachable by the keys, never picked. For a date in a field, the Date picker (opens in a new tab) opens it from a calendar button.
Multiple
With mode="multiple" each press adds a day or takes it out, and the value is the sorted days. maxDays caps how many: once five are picked, the other days fade until one comes out.
Range
With mode="range" the value is [start, end], and null until both ends are picked. months={2} puts two months side by side, and they stack when there isn’t room.
Presets
Hold the value and the month to set them from outside: a vertical Segmented control of presets, which lets go once days are picked by hand.
Min and max
Days before min and after max fade, and the arrows and the popover’s months and years stop at them. A month’s name is two presses from any year.
Day content
dayContent draws what a day shows in place of its number, such as a price. Screen readers still hear the full date first.
Week numbers
showWeekNumbers puts each week’s number before it, by ISO 8601 when weeks start on Monday. weekOfYear from the dates lib gives the same number.
In a form
In a Field, the label names the calendar and the day is sent under the field’s name. With required, sending it empty shows the error and focuses the grid.
Labels
locale names the months and days, and labels names the calendar’s own buttons, here in French.
Month
With granularity='month' the Calendar picks a month from its year’s twelve, as its heading’s popover does, and the value is yyyy-mm. The year steps out to twelve years.
Year
With granularity='year' it picks a year from twelve, and the value is yyyy. min and max take a year, a month or a day.
Cancel a change
Every callback gets Base UI’s change details: details.cancel() keeps the value, and onFocusedChange follows the day with focus, to say why a day can’t be picked.
Installation
npx shadcn@latest add https://kinoui.com/r/calendar.json- Files
lib/reduce-motion.tslib/scroll.tslib/refs.tslib/resize.tslib/swap.tsxlib/popup.tslib/glide.tsxcomponents/kino/tooltip.tsxlib/cut.tsxlib/dates.tscomponents/kino/spinner.tsxcomponents/kino/button.tsxlib/controllable.tslib/field-control.tsxcomponents/kino/popover.tsxlib/run-progress.tslib/highlight.tslib/pill.tscomponents/kino/calendar.tsxlib/calendar-model.tslib/calendar-state.tslib/calendar-grid.tsxlib/calendar-choices.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Props
Data attributes
CSS variables
Accessibility
- Each month is a grid with the keys of the WAI-ARIA date grid (opens in a new tab): the arrows move a day or a week, Home and End to the week’s ends, Page Up and Page Down a month, with Shift a year. Focus turns the months when it leaves them.
- Name it with
aria-label, or put it in aField, whose label names it and whose description and error describe it; a press on the label focuses the grid. Each month’s grid takes its month’s name, and every day says its full date. - Week numbers head their rows, named by
labels.week. Every built-in name comes fromlabels, so the calendar speaks its page’s language. - Unavailable days keep focus, so a screen reader hears that they can’t be picked; days outside
minandmaxcan’t be reached. - The months’ name is a button that opens a Popover (opens in a new tab) of months, with focus on the month shown; Escape closes it back onto the button, and a pick moves focus to the new month’s name.
- The months on screen are announced as they turn.
- Today is in bold and
aria-current="date"; the pick is a filled pill, with the system highlight in forced colours. - When the system asks for less motion, the months, the pill and the band change at once and only fade.