Date picker
A React date picker built on Base UI. Type a date into its segments or pick it from a calendar that opens beside the field, one day, a range, a month, a year or a date and its time, with presets, a clear button and form validation.
Examples
Default
Type the date, or press the calendar button to pick it. The pick closes the calendar and rolls each segment to its new value.
Range
With mode="range" the box holds two dates and one highlight glides across both. The calendar stays open until both ends are picked, and the value is [start, end], null until then.
Month
With granularity='month' the box drops the day and the calendar picks one of the year’s twelve months. The value is yyyy-mm, and granularity='year' picks a year the same way.
Date and time
With granularity='minute' the box holds the date and the time, and the time sits under the calendar. A day picked before its time moves focus to the time, and the calendar closes once both are in. The value is yyyy-mm-ddTHH:mm.
Presets
DatePickerPresets puts the ranges people ask for most beside the calendar and marks the one the value matches. DatePickerClear empties the field once it holds a date.
Button
For a date that is picked, never typed, DatePickerButton writes it in words and opens the calendar. Its children show until a day is picked.
In a form
In a Field, the label names the field and the date is sent as yyyy-mm-dd under the Field’s name. With required, sending it empty shows the error and focuses the first segment. A typed day the picker won’t take, such as a Saturday here, fails the same way.
Locale
locale sets the segments’ order and the calendar’s names and first weekday: month first in the United States. monthFormat="short" types the month by name.
Installation
npx shadcn@latest add https://kinoui.com/r/date-picker.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.tsxlib/segments.tslib/segment-field.tsxcomponents/kino/input.tsxlib/roll.tsxlib/segmented-input.tsxcomponents/kino/time-input.tsxcomponents/kino/textarea.tsxcomponents/kino/input-group.tsxcomponents/kino/segmented-control.tsxlib/roomy.tscomponents/kino/date-picker.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
DatePicker
DatePickerInput
DatePickerButton
DatePickerPreset
Data attributes
CSS variables
Accessibility
- Each segment is a spinbutton, as in the Date input (opens in a new tab): digits move on by themselves, the arrows step a segment, and Tab goes from segment to segment. A range’s two dates are groups named after the field: "Stay, Start date" and "Stay, End date".
- The calendar button opens a Popover (opens in a new tab) with focus on the picked day, or today, for the keys of the WAI-ARIA date grid (opens in a new tab). Escape closes it, and focus goes back to the button; so does a pick.
- In a
Field, the label names the field and focuses its first segment, and the description and error describe it. A date outsideminandmaxfails the form’s check, as a native date input does. - The clear button is named by
labels.clearand leaves once the field is empty, with focus on the first segment. - Every built-in name comes from
labels, so the picker speaks its page’s language. - When the system asks for less motion, the highlight and the numbers change at once, and the calendar only fades.