structyl

Date Picker

stable

A calendar inside a popover for picking a date.

Basic usage

Examples

Controlled with min/max

Restrict selectable dates to a valid booking window.

MUI-style field

Use the direct component API for label, value, onChange, validation bounds, view props and helper text.

Only dates inside the release window can be selected.

Validation and loading

Mirror MUI validation props such as disablePast, shouldDisableDate, loading and renderLoading.

Weekends and past dates are disabled.

Date picker field

DatePicker combines a trigger, value display and calendar popover.

Features

  • MUI-style field API.
  • Popover-anchored calendar.
  • Controlled or uncontrolled.

Installation

bash
pnpm dlx structyl add date-picker

API Reference

DatePicker

MUI-style date field with label, trigger and calendar popover.

PropTypeDefault
value / defaultValueDate | null

Controlled or uncontrolled date value.

onChange / onAccept(value, context) => void

MUI-style callbacks with validationError, source and shortcut metadata.

onError(error, value) => void

Called when validation error state changes.

open / onOpen / onCloseboolean / callbacks

Controlled popover state and lifecycle callbacks.

label / name / inputRefReact.ReactNode / string / ref

Field label and form integration props.

format / formatDensitystring | Intl.DateTimeFormatOptions

Input display format and dense/spacious separator density.

minDate / maxDate / disablePast / disableFutureDate / boolean

Date validation bounds.

shouldDisableDate / shouldDisableMonth / shouldDisableYear(date: Date) => boolean

Custom date, month and year validation callbacks.

views / view / openTo / onViewChangeArray<'day' | 'month' | 'year'>

MUI-compatible view control props.

selectedSections / onSelectedSectionsChangeFieldSelectedSections

MUI-compatible field section selection props.

loading / renderLoadingboolean / () => ReactNode

Render a loading state instead of the calendar.

dayOfWeekFormatter / displayWeekNumber / fixedWeekNumber / showDaysOutsideCurrentMonthcalendar props

Calendar rendering options.

disableOpenPicker / disabled / readOnly / autoFocusboolean

Interaction and field state props.

desktopModeMediaQuery / orientation / reduceAnimations / referenceDate / timezoneMUI compatibility props

Accepted for API parity.

slots / slotProps / sx / viewRenderersobject

MUI customization props accepted by the component surface.

DatePicker.Root

Compound date input — Calendar inside a Popover.

PropTypeDefault
valueDate | null

Controlled date.

onValueChange(date?: Date) => void

Structyl-style change callback.

DatePicker.Trigger

The button that opens the calendar.

PropTypeDefault

DatePicker.Content

The popover containing the calendar.

PropTypeDefault
childrenReact.ReactNode

Custom calendar content. Defaults to DatePicker.Calendar.

DatePicker.Calendar

Styled calendar bound to DatePicker state.

PropTypeDefault
Date Picker | structyl