Skip to content

React Date Picker

A glass React date picker that opens a calendar in a popover, or in a bottom sheet on phones, for single dates and ranges.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/date-picker.json

Schedule your delivery

Pick a day for the courier.

  • DatePicker
  • DateRangePicker
  • defaultDatePickerLabels
  • defaultDateRangePickerLabels
  • +2 more

Using it in a form? See the react-hook-form and zod recipe.

Single date

Today / Clear in the footer, × in the field. Resize below 640px to get the bottom sheet.

We'll remind you the day before.

Files to copy

9 folders · 14 files · 4 packages
From theme/src/
  • components/calendar/
  • components/date-picker/
  • components/button/
  • components/spinner/
  • components/status-icons/
  • hooks/{use-controllable.ts, use-direction.ts, use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{cn.ts, field-size.ts, form.ts, popup-motion.ts, state-light.tsx, warn-once.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/date-picker.jsonRegistry item: date-picker. The styles need the Tailwind v4 glass UI setup.
Packages
pnpm add @base-ui/react clsx motion tailwind-merge

Bounds and unavailable days

Weekdays in the next 60 days only. The month arrows stop at the bounds.

Date range with presets

Two months side by side where they fit beside the presets, one on tablets and phones (there the presets become a swipeable row). Hover previews the range; nothing after today.

In a form

name submits YYYY-MM-DD; a range submits startName / endName. Errors show under the field.

DatePicker props

PropTypeDefaultDescription
onBlurFocusEventHandler<HTMLElement>NoneCalled when focus leaves the control (not when it moves between the control's own parts).
namestringNoneSubmits the day as YYYY-MM-DD with a form.
requiredbooleanNoneMark the field as required (the label shows an asterisk and "Required" is read).
disabledbooleanNoneDisables the whole field and its picker.
aria-invalidboolean | "true" | "false"NoneMarks the field as invalid (also set automatically when error is shown).
aria-describedbystringNoneIds of elements that describe the field, merged with the control's own description and error ids.
sizeFieldSize"md"Height, consistent across every form control: "sm" 32px, "md" 40px, "lg" 48px (sm and md are 44px on touch screens), the same scale as Button.
labelReactNodeNoneText above the field, linked to it as its accessible name (the chosen value is read after it).
descriptionReactNodeNoneMuted helper text under the field. Hidden while an error shows.
errorReactNodeNoneShows an error message under the field. Marks it invalid and is announced.
localestringthe browser'sBCP 47 locale for the field text and the calendar.
todayDatethe current dateWhat counts as "today" (highlighted day, Today button).
weekStartsOnWeekdaythe locale'sFirst day of the week: 0 is Sunday, 1 Monday.
minDate | nullNoneThe earliest day that can be selected.
maxDate | nullNoneThe latest day that can be selected.
isDateDisabled((date: Date) => boolean)NoneReturn true for days that cannot be picked (holidays, booked days).
formatOptionsIntl.DateTimeFormatOptions{ dateStyle: "medium" }How the field shows the value.
clearablebooleantrueShow the × button once there is a value.
closeOnSelectbooleantrueClose as soon as a date (or a full range) is picked.
openbooleanNoneWhether the calendar is open (controlled).
defaultOpenbooleanfalseOpen on first render (uncontrolled).
onOpenChange((open: boolean) => void)NoneCalled when the calendar opens or closes.
idstringNoneSets the id of the field button.
aria-labelstringNoneAccessible name when there is no visible label (the value is read after it).
calendarLabelsPartial<CalendarLabels>defaultCalendarLabelsCalendar UI strings (month navigation, captions). Every other string, for translation: calendarLabels={{ previousMonth: "…" }}; omitted keys keep the English of defaultCalendarLabels. All 11 keys of CalendarLabels are listed in the key table under the props table.
classNamestringNoneClass for the outer wrapper (label + field + helper text).
triggerClassNamestringNoneAdds extra classes to the field button.
valueDate | nullNoneSets the chosen day when controlled. null means none.
defaultValueDate | nullnullSets the starting day when uncontrolled.
onValueChange((value: Date | null) => void)NoneCalled with the picked day, or null when cleared.
showFooterbooleantrueShow the Today / Clear footer.
labelsPartial<DatePickerLabels>defaultDatePickerLabelsEvery other string, for translation: labels={{ placeholder: "…" }}; omitted keys keep the English of defaultDatePickerLabels. All 7 keys of DatePickerLabels are listed in the key table under the props table.
CalendarLabels keys and English defaults (11)
Pass any key in calendarLabels; the rest keep the defaults of defaultCalendarLabels.
KeyEnglish default
previousMonthPrevious month
nextMonthNext month
previousYearPrevious year
nextYearNext year
previousYearsPrevious 12 years
nextYearsNext 12 years
chooseMonth(caption) => `${caption}, choose month and year`
chooseYear(year) => `${year}, choose year`
rangeStartstart of range
rangeEndend of range
monthChanged(caption) => caption
DatePickerLabels keys and English defaults (7)
Pass any key in labels; the rest keep the defaults of defaultDatePickerLabels.
KeyEnglish default
placeholderPick a date
clearClear date
todayToday
clearDateClear
titleChoose a date
closeClose
requiredRequired

DateRangePicker props

PropTypeDefaultDescription
onBlurFocusEventHandler<HTMLElement>NoneCalled when focus leaves the control (not when it moves between the control's own parts).
namestringNoneField name, used for native form submission and by form libraries.
requiredbooleanNoneMark the field as required (the label shows an asterisk and "Required" is read).
disabledbooleanNoneDisables the whole field and its picker.
aria-invalidboolean | "true" | "false"NoneMarks the field as invalid (also set automatically when error is shown).
aria-describedbystringNoneIds of elements that describe the field, merged with the control's own description and error ids.
sizeFieldSize"md"Height, consistent across every form control: "sm" 32px, "md" 40px, "lg" 48px (sm and md are 44px on touch screens), the same scale as Button.
labelReactNodeNoneText above the field, linked to it as its accessible name (the chosen value is read after it).
descriptionReactNodeNoneMuted helper text under the field. Hidden while an error shows.
errorReactNodeNoneShows an error message under the field. Marks it invalid and is announced.
localestringthe browser'sBCP 47 locale for the field text and the calendar.
todayDatethe current dateWhat counts as "today" (highlighted day, Today button).
weekStartsOnWeekdaythe locale'sFirst day of the week: 0 is Sunday, 1 Monday.
minDate | nullNoneThe earliest day that can be selected.
maxDate | nullNoneThe latest day that can be selected.
isDateDisabled((date: Date) => boolean)NoneReturn true for days that cannot be picked (holidays, booked days).
formatOptionsIntl.DateTimeFormatOptions{ month: "short", day: "numeric", year: "numeric" }How the field shows the value.
clearablebooleantrueShow the × button once there is a value.
closeOnSelectbooleantrueClose as soon as a date (or a full range) is picked.
openbooleanNoneWhether the calendar is open (controlled).
defaultOpenbooleanfalseOpen on first render (uncontrolled).
onOpenChange((open: boolean) => void)NoneCalled when the calendar opens or closes.
idstringNoneSets the id of the field button.
aria-labelstringNoneAccessible name when there is no visible label (the value is read after it).
calendarLabelsPartial<CalendarLabels>defaultCalendarLabelsCalendar UI strings (month navigation, captions). Every other string, for translation: calendarLabels={{ previousMonth: "…" }}; omitted keys keep the English of defaultCalendarLabels. All 11 keys of CalendarLabels are listed in the key table under the props table.
classNamestringNoneClass for the outer wrapper (label + field + helper text).
triggerClassNamestringNoneAdds extra classes to the field button.
valueDateRange | nullNoneThe chosen range { start, end } (controlled). null means none.
defaultValueDateRange | nullnullSets the starting range when uncontrolled.
onValueChange((value: DateRange | null) => void)NoneCalled with the range once both ends are picked, or null when cleared.
numberOfMonthsnumber2Months side by side when the screen has room (fewer on tablets, one on phones).
presetsDateRangePreset[][]One-click ranges shown beside the calendar (above it on phones).
allowUnavailableInRangebooleanfalseLet a range run across unavailable days.
startNamestringNoneSubmit the start / end as YYYY-MM-DD with a form.
endNamestringNoneSets the form field name for the end day.
labelsPartial<DateRangePickerLabels>defaultDateRangePickerLabelsEvery other string, for translation: labels={{ placeholder: "…" }}; omitted keys keep the English of defaultDateRangePickerLabels. All 10 keys of DateRangePickerLabels are listed in the key table under the props table.
DateRangePickerLabels keys and English defaults (10)
Pass any key in labels; the rest keep the defaults of defaultDateRangePickerLabels.
KeyEnglish default
placeholderPick a date range
clearClear dates
clearRangeClear
titleChoose dates
closeClose
presetsQuick ranges
pickStartPick a start date
pickEndNow pick an end date
summary(days) => `${days} ${days === 1 ? "day" : "days"}`
requiredRequired

Keyboard

KeysAction
Enter/Space/Arrow DownOpen the calendar from the field; focus moves to the selected day.
Arrow keys, Page Up/Page DownMove inside the calendar (see the Calendar page).
Enter/SpaceSelect the focused day. A range commits only after both ends are picked.
EscapeClose the calendar and return focus to the field.

Accessibility

  • The trigger is a labeled button showing the chosen date; the calendar opens in a popover, or as a swipe-to-close bottom sheet on phones.
  • Focus lands on the selected day (or today) and returns to the field on close; the sheet keeps the field above the software keyboard.
  • name submits an ISO date with a form; error is announced politely. Pass locale and today on prerendered pages so server and browser text match.

All exports on this page

  • DatePicker — DatePicker: a glass field that opens a Calendar to pick one day.
  • DateRangePicker — DateRangePicker: a glass field that opens a Calendar to pick a start and an end day (bookings, reports).
  • defaultDatePickerLabels — Default English strings of DatePickerLabels; spread it and override single keys to reword.
  • defaultDateRangePickerLabels — Default English strings of DateRangePickerLabels; spread it and override single keys to reword.

When to use the date picker

  • Use it as a mobile-friendly date picker, a popover on desktop and a bottom sheet on phones, for a check-in field on a hotel or rental form where people type nothing and instead open a calendar from a labeled button, with min set to today so past dates are unavailable.
  • Use DateRangePicker when you need a start and an end, for example a reporting period, where its presets such as Next 7 days let people skip the grid entirely.
  • Use it in a form posted to a server: the name prop submits the chosen day as YYYY-MM-DD, so a plain form action or FormData read gets a predictable string.
  • Skip it when the calendar should be permanently visible on the page, as in a scheduling sidebar; Calendar on its own does that, without the field, popover or sheet around it.
  • Pair it with its own description and error props for helper text and the message, Button for a custom reset action beside it, and the calendarLabels prop when translating the grid inside the popup.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .