Date Time Picker API
View componentThe full prop reference for the Date Time Picker component. Pick a date first, then choose the time from one popover with MUI-style props.
Import
import { DateTimePicker } from '@structyl/styled';Props
DateTimePicker (default export / Root component)
Styled date-time picker component with integrated label, helper text, and trigger. A wrapper around the primitive Root with added UI styling and convenience props.
| Prop | Type | Default |
|---|---|---|
| value# | Date | nullControlled date-time value | — |
| defaultValue# | Date | nullUncontrolled initial date-time value | — |
| onChange# | (value: Date | null, context: PickerChangeContext<DateTimeValidationError>) => voidFires on any internal state change (view switch, validation, etc.); includes validation error context | — |
| onValueChange# | (value: Date | undefined) => voidSimplified callback; fires when a date/time is committed | — |
| onAccept# | (value: Date | null, context: PickerChangeContext<DateTimeValidationError>) => voidFires only when a date-time selection is explicitly accepted (e.g., closeOnSelect or accept button) | — |
| onError# | (error: DateTimeValidationError | null, value: Date | null) => voidFires when validation state changes; passes current error (null if valid) and the value | — |
| open# | booleanControlled open state of the popover | — |
| defaultOpen# | booleanUncontrolled initial open state | — |
| onOpenChange# | (open: boolean) => voidFires when popover open state changes | — |
| onOpen# | () => voidFires when popover opens | — |
| onClose# | () => voidFires when popover closes | — |
| closeOnSelect# | booleanAuto-close popover after a time segment is committed (in time picker mode) | false |
| disabled# | booleanDisable all interaction; disables trigger button and blocks value changes | — |
| readOnly# | booleanPrevent value changes but allow viewing/navigation | — |
| minDate# | DateMinimum selectable date (inclusive); enforced by calendar and validation | — |
| maxDate# | DateMaximum selectable date (inclusive); enforced by calendar and validation | — |
| minDateTime# | DateMinimum selectable date-time; used in validation | — |
| maxDateTime# | DateMaximum selectable date-time; used in validation | — |
| minTime# | DateMinimum selectable time of day; validated against time picker | — |
| maxTime# | DateMaximum selectable time of day; validated against time picker | — |
| disablePast# | booleanPrevent selection of any date/time in the past relative to today | — |
| disableFuture# | booleanPrevent selection of any date/time in the future relative to today | — |
| disabledDays# | (date: Date) => booleanCallback to disable specific dates (deprecated alias for shouldDisableDate) | — |
| shouldDisableDate# | (date: Date) => booleanCallback to disable specific calendar dates; used in validation | — |
| shouldDisableMonth# | (date: Date) => booleanCallback to disable specific months; used in validation and calendar navigation | — |
| shouldDisableYear# | (date: Date) => booleanCallback to disable specific years; used in validation and calendar navigation | — |
| shouldDisableTime# | (value: Date, view: TimePickerView) => booleanCallback to disable specific times based on the current view (hours/minutes/seconds) | — |
| weekStartsOn# | numberDay index (0–6) that weeks start on in the calendar; 0 = Sunday | — |
| locale# | stringBCP 47 locale tag; affects calendar headers, month names, and time formatting | — |
| ampm# | booleanUse 12-hour format in time picker and Value display (true = AM/PM, false = 24-hour) | — |
| ampmInClock# | booleanIf true, display AM/PM selector in clock/time picker (when using time views) | — |
| autoFocus# | booleanAuto-focus the trigger button on mount | — |
| dayOfWeekFormatter# | (date: Date) => stringCustom formatter for day-of-week labels in the calendar header | — |
| desktopModeMediaQuery# | stringMedia query string to determine desktop vs mobile layout | — |
| disableHighlightToday# | booleanRemove visual highlight on today's date in the calendar | — |
| disableIgnoringDatePartForTimeValidation# | booleanInclude date part in time validation (normally only time is checked against minTime/maxTime) | — |
| disableOpenPicker# | booleanDisable the trigger button (prevents opening); different from disabled which also blocks internal state changes | — |
| displayWeekNumber# | booleanShow ISO week numbers in the calendar grid | — |
| fixedWeekNumber# | numberForce a fixed number of weeks in the calendar grid (e.g. 6 for consistent height) | — |
| format# | string | Intl.DateTimeFormatOptionsFormat for the Value display; string uses custom tokens (yyyy, MM, dd, HH, mm, ss, aa), or pass Intl options | — |
| formatDensity# | 'dense' | 'spacious'Compact or spacious date/time field layout in some internal views | — |
| inputRef# | React.Ref<HTMLInputElement>Ref forwarded to internal input element (if any) | — |
| keepOpenDuringFieldFocus# | booleanKeep popover open when field receives focus (normally closes on blur) | — |
| label# | React.ReactNodeLabel text or node displayed above the trigger; adds * if required=true | — |
| loading# | booleanShow loading state instead of the picker content | — |
| localeText# | PickerLocaleTextObject of translated UI strings (e.g. { loading: 'Loading...', ... }) | — |
| minutesStep# | numberStep size for minute increments in the time picker (default from timeSteps.minutes) | — |
| monthsPerRow# | 3 | 4Number of month columns in month-picker view (3 or 4) | — |
| name# | stringHTML name attribute for the trigger button | — |
| onMonthChange# | (month: Date) => voidFires when the user navigates to a different month in the calendar | — |
| onSelectedSectionsChange# | (newValue: PickerSelectedSections) => voidFires when the selected field section changes (for field-based input modes) | — |
| onViewChange# | (view: DateTimePickerView) => voidFires when the internal view switches (day → hours, etc.) | — |
| onYearChange# | (year: Date) => voidFires when the user navigates to a different year in the calendar | — |
| openTo# | DateTimePickerViewInitial view to display when popover opens (e.g. 'day', 'month', 'hours') | 'day' |
| orientation# | 'landscape' | 'portrait'Layout orientation hint for the picker | — |
| reduceAnimations# | booleanDisable animations and transitions | — |
| referenceDate# | DateBase date used for context (e.g. when navigating time without a selected date) | — |
| renderLoading# | () => React.ReactNodeCustom render function for the loading state | — |
| selectedSections# | PickerSelectedSectionsControlled selected section in field-based input (day, month, hours, minutes, etc., or 'all') | — |
| defaultSelectedSections# | PickerSelectedSectionsUncontrolled initial selected section | — |
| showDaysOutsideCurrentMonth# | booleanDisplay dates from adjacent months in the calendar grid | — |
| skipDisabled# | booleanIn time picker, skip over disabled time values when using arrow keys | — |
| slotProps# | PickerSlotPropsProps to pass to internal slot components (advanced) | — |
| slots# | PickerSlotsReplace internal components via slot (advanced) | — |
| sx# | PickerSxMUI-style sx prop for styling (advanced) | — |
| thresholdToRenderTimeInASingleColumn# | numberBreak point (in pixels) below which time picker switches to single-column layout | — |
| timeSteps# | TimeStepsObject { hours?, minutes?, seconds? } defining step size for each time unit | — |
| timezone# | stringIANA timezone identifier (if supported by underlying implementation) | — |
| view# | DateTimePickerViewControlled current view (day/month/year/hours/minutes/seconds/meridiem) | — |
| defaultView# | DateTimePickerViewUncontrolled initial view (overrides openTo if not controlled) | — |
| viewRenderers# | Partial<Record<DateTimePickerView, DateTimePickerViewRenderer | null>>Custom renderers for specific views (advanced); null disables that view | — |
| views# | DateTimePickerView[]Array of enabled views (e.g. ['day', 'hours', 'minutes']); determines available navigation | — |
| yearsOrder# | 'asc' | 'desc'Sort order of year options in year picker | — |
| yearsPerRow# | 3 | 4Number of year columns in year-picker view | — |
| className# | stringCSS class applied to the root wrapper div | — |
| triggerClassName# | stringCSS class applied to the trigger button (in addition to base button styles) | — |
| contentClassName# | stringCSS class applied to the popover content container | — |
| calendarClassName# | stringCSS class applied to the calendar grid | — |
| helperText# | React.ReactNodeHelper/description text displayed below the trigger; styled as muted | — |
| placeholder# | React.ReactNodePlaceholder text when no value is selected (passed to Value component) | — |
| id# | stringHTML id for the trigger button (auto-generated if not provided) | — |
| required# | booleanMark label with * and set aria-required; does not enforce validation | — |
| error# | booleanSet aria-invalid on trigger and apply error styling to helperText | — |
| showOutsideDays# | booleanAlias for showDaysOutsideCurrentMonth (for convenience) | — |
DateTimePicker.Trigger
Button that toggles the popover open/closed; pre-styled with calendar icon and default value display
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes (merged with base button styles) | — |
| children# | React.ReactNodeContent; defaults to formatted date-time value if not provided | <DateTimePickerPrimitive.Value /> |
| disabled# | booleanDisable the button | — |
| ...other# | React.HTMLAttributes<HTMLButtonElement>Standard HTML button attributes (onClick, onFocus, etc.) | — |
DateTimePicker.Content
Popover content container; renders calendar + time picker panels with loading state support
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes (merged with popover base styles) | — |
| align# | 'start' | 'center' | 'end'Popover alignment relative to trigger | 'center' |
| sideOffset# | numberDistance (px) between popover and trigger | 6 |
| calendarClassName# | stringCSS classes for the calendar grid inside Content | — |
| loading# | booleanShow loading state instead of date/time pickers | — |
| showOutsideDays# | booleanPass through to Calendar (show adjacent month dates) | — |
| showDaysOutsideCurrentMonth# | booleanPass through to Calendar (show adjacent month dates); alias for showOutsideDays | — |
| withSeconds# | booleanInclude seconds field in time picker display | — |
| ampm# | booleanUse 12-hour format in time picker | — |
| maxTime# | DateMaximum selectable time; passed to TimePickerPanel | — |
| minTime# | DateMinimum selectable time; passed to TimePickerPanel | — |
| minutesStep# | numberStep size for minute increments; passed to TimePickerPanel | — |
| shouldDisableTime# | (value: Date, view: TimePickerView) => booleanDisable specific times; passed to TimePickerPanel | — |
| skipDisabled# | booleanSkip disabled time values in navigation; passed to TimePickerPanel | — |
| timeSteps# | TimeStepsTime step config; passed to TimePickerPanel | — |
| views# | DateTimePickerView[]Enabled views; passed to TimePickerPanel for filtering time views | — |
| children# | React.ReactNodeCustom content; if provided, overrides default calendar + time picker layout | — |
| ...other# | React.HTMLAttributes<HTMLDivElement>Standard HTML div attributes | — |
DateTimePicker.Calendar
Calendar grid for selecting the date part; renders month/year/day views with styled day buttons
| Prop | Type | Default |
|---|---|---|
| className# | stringAdditional CSS classes (merged with base calendar styles) | — |
| showOutsideDays# | booleanShow dates from adjacent months in the grid | — |
| showDaysOutsideCurrentMonth# | booleanAlias for showOutsideDays | — |
| locale# | stringBCP 47 locale (inherited from Root context) | — |
| ...other# | Omit<CalendarPrimitive.CalendarRootProps, 'selected' | 'onSelect' | 'mode'>Calendar props; selected/onSelect/mode are internally controlled | — |
DateTimePicker.DatePanel
Container shown when the date view is active; renders the Calendar inside
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS classes | — |
| ...other# | React.HTMLAttributes<HTMLDivElement>Standard HTML div attributes | — |
DateTimePicker.TimePanel
Container shown when a time view is active; renders time picker controls with date switcher button
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS classes | — |
| children# | React.ReactNode | (props: TimePanelRenderProps) => React.ReactNodeContent or render function; receive value, onChange, onAccept, onCancel, view, setView | — |
| ...other# | React.HTMLAttributes<HTMLDivElement>Standard HTML div attributes | — |
DateTimePicker.DateButton
Button inside TimePanel to switch back to date picker; labeled 'Change date'
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS classes (merged with base button styles) | — |
| ...other# | React.HTMLAttributes<HTMLButtonElement>Standard HTML button attributes | — |
DateTimePicker.Segment
Spinbutton-style segment (hour, minute, second, or AM/PM) in the time picker; keyboard-navigable with arrow keys
| Prop | Type | Default |
|---|---|---|
| segment# | 'hour' | 'minute' | 'second' | 'period'Which time segment this control represents | — |
| className# | stringCSS classes (merged with base segment styles) | — |
| ...other# | React.HTMLAttributes<HTMLSpanElement>Standard HTML span attributes; ArrowUp/ArrowDown adjust the value | — |
DateTimePicker.Separator
Visual separator (typically ':') between time segments
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS classes | — |
| children# | React.ReactNodeSeparator character or content | ':' |
| ...other# | React.HTMLAttributes<HTMLSpanElement>Standard HTML span attributes | — |
DateTimePicker.Value
Formatted display of the selected date-time; used as default Trigger/Content children
| Prop | Type | Default |
|---|---|---|
| format# | string | Intl.DateTimeFormatOptionsFormat for display; string uses custom tokens (yyyy, MM, dd, HH, mm, ss, aa) | { dateStyle: 'medium', timeStyle: 'short' } |
| locale# | stringBCP 47 locale for Intl.DateTimeFormat | — |
| placeholder# | React.ReactNodeFallback text when no value is selected | 'Pick date and time' |
DateTimePicker.Loading
Loading state display; shown in Content when loading=true
| Prop | Type | Default |
|---|
DateTimePicker.Root (primitive export)
Unstyled primitive root; provides context and state management for all sub-components. Use this for fully custom layouts.
| Prop | Type | Default |
|---|---|---|
| children# | React.ReactNodeSub-components (Trigger, Content, Calendar, TimePanel, etc.) | — |
| value# | Date | nullControlled date-time value | — |
| defaultValue# | Date | nullUncontrolled initial date-time value | — |
| onChange# | (value: Date | null, context: PickerChangeContext<DateTimeValidationError>) => voidInternal state change callback with validation context | — |
| onValueChange# | (value: Date | undefined) => voidCommitted value change callback | — |
| onAccept# | (value: Date | null, context: PickerChangeContext<DateTimeValidationError>) => voidExplicit accept (close) callback | — |
| onError# | (error: DateTimeValidationError | null, value: Date | null) => voidValidation error change callback | — |
| open# | booleanControlled popover open state | — |
| defaultOpen# | booleanUncontrolled initial open state | — |
| onOpenChange# | (open: boolean) => voidOpen state change callback | — |
| onOpen# | () => voidPopover opened callback | — |
| onClose# | () => voidPopover closed callback | — |
| closeOnSelect# | booleanAuto-close on time segment commit | false |
| disabled# | booleanDisable interactions | — |
| readOnly# | booleanPrevent changes but allow viewing | — |
| minDate# | DateMinimum selectable date | — |
| maxDate# | DateMaximum selectable date | — |
| minDateTime# | DateMinimum selectable date-time | — |
| maxDateTime# | DateMaximum selectable date-time | — |
| minTime# | DateMinimum selectable time of day | — |
| maxTime# | DateMaximum selectable time of day | — |
| disablePast# | booleanDisable past dates/times | — |
| disableFuture# | booleanDisable future dates/times | — |
| disabledDays# | (date: Date) => booleanDeprecated; use shouldDisableDate | — |
| shouldDisableDate# | (date: Date) => booleanCustom date disable logic | — |
| shouldDisableMonth# | (date: Date) => booleanCustom month disable logic | — |
| shouldDisableYear# | (date: Date) => booleanCustom year disable logic | — |
| shouldDisableTime# | (value: Date, view: TimePickerView) => booleanCustom time disable logic | — |
| weekStartsOn# | numberDay index (0=Sunday) that weeks start on | — |
| locale# | stringBCP 47 locale tag | — |
| ampm# | booleanUse 12-hour format | false |
| ampmInClock# | booleanShow AM/PM selector in time views | — |
| autoFocus# | booleanAuto-focus first interactive element | — |
| dayOfWeekFormatter# | (date: Date) => stringCustom day-of-week label formatter | — |
| desktopModeMediaQuery# | stringMedia query for desktop mode | — |
| disableHighlightToday# | booleanDon't highlight today's date | — |
| disableIgnoringDatePartForTimeValidation# | booleanInclude date in time validation | — |
| disableOpenPicker# | booleanDisable opening the picker | — |
| displayWeekNumber# | booleanShow ISO week numbers | — |
| fixedWeekNumber# | numberForce fixed number of weeks in calendar | — |
| format# | string | Intl.DateTimeFormatOptionsValue display format | — |
| formatDensity# | 'dense' | 'spacious'Field density | — |
| inputRef# | React.Ref<HTMLInputElement>Ref to internal input (if present) | — |
| keepOpenDuringFieldFocus# | booleanKeep popover open on field focus | — |
| label# | React.ReactNodeLabel node | — |
| loading# | booleanShow loading state | — |
| localeText# | PickerLocaleTextTranslated UI strings | — |
| minutesStep# | numberStep size for minutes | — |
| monthsPerRow# | 3 | 4Columns in month view | — |
| name# | stringHTML name attribute | — |
| onMonthChange# | (month: Date) => voidCalendar month navigation | — |
| onSelectedSectionsChange# | (newValue: PickerSelectedSections) => voidSelected field section change | — |
| onViewChange# | (view: DateTimePickerView) => voidView switch callback | — |
| onYearChange# | (year: Date) => voidCalendar year navigation | — |
| openTo# | DateTimePickerViewInitial view on open | 'day' |
| orientation# | 'landscape' | 'portrait'Layout orientation | — |
| reduceAnimations# | booleanDisable animations | — |
| referenceDate# | DateBase date for context | — |
| renderLoading# | () => React.ReactNodeCustom loading render function | — |
| selectedSections# | PickerSelectedSectionsControlled selected section | — |
| defaultSelectedSections# | PickerSelectedSectionsUncontrolled initial selected section | — |
| showDaysOutsideCurrentMonth# | booleanShow adjacent month dates | — |
| skipDisabled# | booleanSkip disabled times in navigation | — |
| slotProps# | PickerSlotPropsAdvanced: props for slots | — |
| slots# | PickerSlotsAdvanced: component slot overrides | — |
| sx# | PickerSxAdvanced: MUI-style sx prop | — |
| thresholdToRenderTimeInASingleColumn# | numberResponsive breakpoint for time layout | — |
| timeSteps# | TimeStepsStep sizes { hours?, minutes?, seconds? } | — |
| timezone# | stringIANA timezone identifier | — |
| view# | DateTimePickerViewControlled current view | — |
| defaultView# | DateTimePickerViewUncontrolled initial view | — |
| viewRenderers# | Partial<Record<DateTimePickerView, DateTimePickerViewRenderer | null>>Custom view renderers | — |
| views# | DateTimePickerView[]Enabled views array | — |
| yearsOrder# | 'asc' | 'desc'Year sort order | — |
| yearsPerRow# | 3 | 4Columns in year view | — |
Source code
If you didn't find what you need here, read the component implementation .