Date Picker

A date field that opens a calendar for picking a date or a range.

Usage

Code
import { DatePicker, Portal } from '@leverui/components';
Code
<DatePicker.Root>
  <DatePicker.Label />
  <DatePicker.Control>
    <DatePicker.Input />
    <DatePicker.IndicatorGroup>
      <DatePicker.Trigger>
        <CalendarIcon />
      </DatePicker.Trigger>
    </DatePicker.IndicatorGroup>
  </DatePicker.Control>
  <Portal>
    <DatePicker.Positioner>
      <DatePicker.Content>
        <DatePicker.View view="day">
          <DatePicker.Header />
          <DatePicker.DayTable />
        </DatePicker.View>
        <DatePicker.View view="month">
          <DatePicker.Header />
          <DatePicker.MonthTable />
        </DatePicker.View>
        <DatePicker.View view="year">
          <DatePicker.Header />
          <DatePicker.YearTable />
        </DatePicker.View>
      </DatePicker.Content>
    </DatePicker.Positioner>
  </Portal>
</DatePicker.Root>

Date Value

Dates are @internationalized/date objects. Install that package to use its functions, such as parseDate. DatePicker also exports DatePicker.parseDate and DatePicker.DateValue.

The Temporal API will replace this package once most browsers support it.

Examples

Sizes

Use the size prop to change the size of the date picker.

Variants

Use the variant prop to change the visual style of the date picker.

Disabled

Use the disabled prop to prevent user interaction with the date picker.

Read Only

Use the readOnly prop to prevent modification while keeping the value visible.

Default View

Use the defaultView prop to set the initial calendar view to "day", "month", or "year".

Opens with month view

Default Value

Use the defaultValue prop to set the initially selected date.

Controlled

Use the value and onValueChange props to control the selected date.

Selected: 2026-01-26

Store

An alternative way to control the date picker is to use the RootProvider component and the useDatePicker store hook.

Selected: None

Range Selection

Set the selectionMode prop to "range" to allow selecting a start and end date.

Multiple Selection

Set the selectionMode prop to "multiple" to allow selecting multiple dates.

Select dates...

Month Picker

Set the defaultView and minView props to "month" to restrict the picker to month selection only.

Month Range

Set the selectionMode prop to "range" and minView to "month" to select a month range.

Year Picker

Set the defaultView and minView props to "year" to restrict the picker to year selection only.

Year Range

Set the selectionMode prop to "range" and minView to "year" to select a year range.

Min/Max

Use the min and max props to restrict date selection to a specific range.

Unavailable Dates

Use the isDateUnavailable prop to disable specific dates (e.g., weekends, holidays).

Formatting & Parsing

Use the format and parse props to control how dates are displayed and interpreted.

Localization

Use the locale prop to display the calendar in different languages and regional formats.

Persian (Jalali) Calendar

Use the createCalendar prop with locale="fa-IR" to render the Persian (Jalali) calendar.

Button Trigger

Replace the default trigger with a styled custom button.

Outside Icon

Place the trigger icon outside the input field.

Input Group

Integrate with InputGroup for custom input layouts with start/end elements.

Clear Icon

Add a clear trigger to reset the selection.

Placement

Use the positioning prop to control the placement of the calendar popover.

Header Layout

Here's an example of customizing the header layout with RangeText and navigation buttons.

Month and Year Select

Render the DatePicker.MonthSelect and DatePicker.YearSelect components for quick month/year navigation.

Multiple Months

Use the numOfMonths prop to display multiple months side by side.

Presets

Render the DatePicker.PresetTrigger component to provide quick date selection options.

Presets Sidebar

Here's an example of a task-management style picker with presets sidebar and calendar side by side.

November 2026
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12

Today Button

Here's an example of adding a footer button to quickly jump to today's date.

With Time

Here's an example of combining date selection with a time input for datetime picking.

Form

Here's an example of integrating with native form validation.

Form Integration

Here's an example of integrating form state held in Solid signals with the date picker, validated on submit.

Fixed Weeks

Use the fixedWeeks prop to always display 6 weeks in the calendar, ensuring a consistent height regardless of the month.

Open on Click

Use the openOnClick prop to open the calendar when clicking the input field, removing the need for a separate trigger button.

Field

The DatePicker does not natively integrate with the Field component yet. Use Field.Context to wire up the field state manually. Native support will be added in a future version.

Guides

Custom grids

DayTable, MonthTable, and YearTable are built from smaller table parts. For your own grid, use Table, TableHead, TableBody, TableRow, TableCell, and TableCellTrigger.

TableCellTrigger and RangeText render a div. The trigger acts as an accessible calendar cell, not a real button.

Table.columns and TableCell.columns set the calendar's logic, not the layout. Use style for CSS columns. Header holds the previous control, the range and view control, and the next control.

DayTable takes offset, for showing more than one month, and weekNumberLabel. showWeekNumbers on the root shows the week number columns.

Each table's accessible name is the range of dates on screen, in the current locale. Pass aria-label or aria-labelledby to change it.

Form values

With name set, the selected date is sent with the form as text, formatted for the current locale.

Machine access

To control a date picker from outside, create it with DatePicker.useDatePicker and pass the result to DatePicker.RootProvider.

DatePicker.PropsProvider sets default props for the roots inside it. The defaults can change over time. DatePicker.Context and useDatePickerContext read the state of the nearest date picker.

Props

Root

PropDefaultTypeDescription
closeOnSelecttruebooleanClose the calendar on pick. No effect when selectionMode is multiple.
defaultViewdayDateViewView the calendar opens in.
localeen-USstringLocale for formatting, as a BCP 47 tag.
maxViewyearDateViewLargest view the calendar can switch to.
minViewdayDateViewSmallest view the calendar can switch to.
selectionModesingleSelectionModeHow many dates can be picked: single, multiple, or range (a start and an end).
timeZoneUTCstringTime zone to use.
colorPalette—stringColor palette, built in or your own.
sizemd'xs' | 'sm' | 'md' | 'lg' | 'xl'Date picker size.
variantoutline'outline' | 'subtle' | 'flushed'Date picker style.
asdivNative tagHTML tag to render.
asChild—Solid render functionRender your own element with the part's props.
unstyled—booleanTurn off the Lever UI styles.
createCalendar—(identifier: CalendarIdentifier) => CalendarReturns a Calendar for an identifier. Adds other calendars, such as Persian, Buddhist or Islamic.
defaultFocusedValue—DateValueDate focused at first.
defaultOpen—booleanStart open.
defaultValue—DateValue[]Dates selected at first.
disabled—booleanDisable the calendar.
fixedWeeks—booleanAlways show 6 weeks, not 5 or 6 by month.
focusedValue—DateValueFocused date, when you control it.
format—(date: DateValue, details: LocaleDetails) => stringTurns a date into the input text.
id—stringUnique id for the date picker.
ids—Partial<{ root: string; label: (index: number) => string; table: (id: string) => string; tableHeader: (id: string) => string; tableBody: (id: string) => string; tableRow: (id: string) => string; content: string; ... 10 more ...; positioner: string; }>Ids of the elements in the date picker.
immediate—booleanApply a change to present right away, not on the next frame.
inline—booleanRender inline, directly on the page.
invalid—booleanMark the date picker as invalid.
isDateUnavailable—(date: DateValue, locale: string) => booleanReturns whether a date is unavailable.
lazyMountfalsebooleanRender the calendar only when first opened.
max—DateValueLatest date that can be picked.
maxSelectedDates—numberMost dates that can be picked. Only when selectionMode is multiple.
min—DateValueEarliest date that can be picked.
name—stringname attribute of the input.
numOfMonths—numberMonths to show at once.
onExitComplete—VoidFunctionCalled when the closing animation ends.
onFocusChange—(details: FocusChangeDetails) => voidCalled when the focused date changes.
onOpenChange—(details: OpenChangeDetails) => voidCalled when the calendar opens or closes.
onValueChange—(details: ValueChangeDetails) => voidCalled when the value changes.
onViewChange—(details: ViewChangeDetails) => voidCalled when the view changes.
onVisibleRangeChange—(details: VisibleRangeChangeDetails) => voidCalled when the dates on screen change.
open—booleanOpen state, when you control it.
openOnClickfalsebooleanOpen the calendar when the input is clicked.
outsideDaySelectablefalsebooleanLet people pick days outside the range on screen.
parse—(value: string, details: LocaleDetails) => DateValue | undefinedTurns the input text into a DateValue.
placeholder—stringPlaceholder text in the input.
positioning—PositioningOptionsWhere the calendar is placed.
present—booleanWhether the calendar is present, when you control it.
readOnly—booleanMake the calendar read-only.
required—booleanMark the date picker as required.
showWeekNumbers—booleanShow a week number column in the day view.
skipAnimationOnMountfalsebooleanSkip the opening animation on first render.
startOfWeek—numberFirst day of the week, 0 (Sunday) to 6 (Saturday).
translations—IntlTranslationsTranslated messages to use.
unmountOnExitfalsebooleanRemove the calendar from the page when it closes.
value—DateValue[]Selected dates, when you control them.
view—DateViewCalendar view, when you control it.
hideOutsideDays—booleanHide days outside the current month. Responsive.

Input

PropDefaultTypeDescription
fixOnBlurtruebooleanCorrect the input value on blur.
asinputNative tagHTML tag to render.
asChild—Solid render functionRender your own element with the part's props.
index—numberIndex of the input to focus.

View

PropDefaultTypeDescription
view (required)—DateView
asdivNative tagHTML tag to render.
asChild—Solid render functionRender your own element with the part's props.

TableCell

PropDefaultTypeDescription
value (required)—number | DateValue
astdNative tagHTML tag to render.
asChild—Solid render functionRender your own element with the part's props.
columns—number
disabled—boolean
visibleRange—VisibleRange

PresetTrigger

PropDefaultTypeDescription
value (required)—PresetTriggerValue
asbuttonNative tagHTML tag to render.
asChild—Solid render functionRender your own element with the part's props.

Customize with CSS

Import @leverui/components/styles.css for the default look. size, variant, and hideOutsideDays take a value per screen size.

Classes: .leverui-date-picker__<slot> on the root and each part. Attributes: data-size, data-variant, and the supported breakpoint attributes. Content rendered in a portal gets the same values.

Variables: set --leverui-date-picker-* on :root, on a theme wrapper, or on a single picker. Parts accept class, style, unstyled, as, and asChild.

Explorer

Click a part name to highlight it in the preview.

Component Anatomy

Hover to highlight, click to select parts