Skip to content

Date Time Picker

Choose a local date and time with coordinated field and calendar controls.

Usage

Schedule

Choose a deployment date and wall-clock time together.

Choose a deployment date and wall-clock time together.

Morning

Choose a morning date and time as one local schedule value.

Choose a morning date and time as one local schedule value.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Floating positioning

This component uses the shared positioning engine. Use the live positioning example to change side, align, offsets, collision boundaries, strategy, and tracking while inspecting the resolved placement.

API

Vue package: @sectile/vue/temporal/date-time-picker

Components
  • DateTimePickerRoot
  • DateTimePickerTrigger
  • DateTimePickerAnchor
  • DateTimePickerPortal
  • DateTimePickerContent
  • DateTimePickerGrid
  • DateTimePickerCell
  • DateTimePickerMonthCell
  • DateTimePickerDateTimeInput
  • DateTimePickerDateInput
  • DateTimePickerTimeInput
  • DateTimePickerPreviousWeek
  • DateTimePickerNextWeek
  • DateTimePickerPreviousMonth
  • DateTimePickerNextMonth
  • DateTimePickerPreviousYear
  • DateTimePickerNextYear
  • DateTimePickerWeekViewTrigger
  • DateTimePickerMonthViewTrigger
  • DateTimePickerYearViewTrigger

Props

DateTimePickerRootProps

align

Alignment of positioned content relative to its anchor.

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

avoidCollisions

Whether positioned content may flip or shift to remain visible.

collisionBoundary

Boundary used to keep positioned content visible.

collisionPadding

Space kept between positioned content and its collision boundary.

defaultHighlightedValue

Initially highlighted value for uncontrolled state.

defaultOpen

Initial uncontrolled open state.

defaultValue

Initial value used when the component owns its state.

defaultView

Initial calendar or picker view.

disabled

Whether interaction is unavailable.

hideWhenDetached

Whether positioned content hides when its anchor leaves the layout.

highlightedValue

Value currently highlighted for keyboard interaction.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

open

Whether the associated popup or disclosure is open.

policies

Behavior policies that customize validation, movement, or selection.

position

Whether the popup is positioned relative to its trigger.

readonly

Whether the value can be inspected but not changed.

referenceDate

Deterministic civil date used when a calendar has no selected or highlighted value.

required

Whether the control must contain a valid value before submission.

side

Preferred side of the anchor for positioned content.

sideOffset

Distance between positioned content and its anchor.

strategy

CSS positioning strategy used for anchored content.

tracking

Update strategy used while anchored content is open.

DateTimePickerPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

DateTimePickerPortalProps

defer

Whether Teleport target resolution waits until the end of the current mount or update tick.

disabled

Whether interaction is unavailable.

to

Teleport target for portalled content.

Slots

DateTimePickerRootSlotProps

dates

Dates projected by the active view.

disabled

Whether interaction is unavailable.

highlightedValue

Value currently highlighted for interaction.

months

Months projected by the active view.

open

Whether the associated popup or disclosure is open.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

view

Current calendar anchor.

viewMode

Active calendar view mode.

years

Years projected by the active view.

DateTimePickerCellSlotProps

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

inRange

Whether this value lies inside the selected range.

outsideMonth

Whether this date belongs to an adjacent month.

selected

Whether this item is selected.

value

Current value exposed by this contract.

DateTimePickerMonthCellSlotProps

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

inRange

Whether this value lies inside the selected range.

selected

Whether this item is selected.

value

Current value exposed by this contract.

Other types

DateTimePickerValueChangeHandler

ts
type DateTimePickerValueChangeHandler = NonNullable<InstanceType<typeof DateTimePickerRoot>['$props']['onUpdate:modelValue']>

DateTimePickerOpenChangeHandler

ts
type DateTimePickerOpenChangeHandler = NonNullable<InstanceType<typeof DateTimePickerRoot>['$props']['onUpdate:open']>

DateTimePickerHighlightedValueChangeHandler

ts
type DateTimePickerHighlightedValueChangeHandler = NonNullable<InstanceType<typeof DateTimePickerRoot>['$props']['onUpdate:highlightedValue']>

DateTimeValue

NameTypeRequired
dateDateValueYes
timeTimeValueYes

DateValue

NameTypeRequired
yearnumberYes
monthnumberYes
daynumberYes

Parts

Shared scope: [data-scope="date-time-picker"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
date-time-input[data-part="date-time-input"]Edits a combined date and time value.
date-input[data-part="date-input"]Edits the date portion of a date-time value.
time-input[data-part="time-input"]Edits the time portion of a date-time value.
anchor[data-part="anchor"]Provides the positioning reference for floating content.
trigger[data-part="trigger"]Opens, closes, or activates the associated content.
content[data-part="content"]Contains the component content shown for the active state.
week-view-trigger[data-part="week-view-trigger"]Switches the calendar to the week view.
month-view-trigger[data-part="month-view-trigger"]Switches the calendar to the month view.
year-view-trigger[data-part="year-view-trigger"]Switches the calendar to the year view.
previous-week[data-part="previous-week"]Moves to the previous week.
next-week[data-part="next-week"]Moves to the next week.
previous-month[data-part="previous-month"]Moves to the previous month.
next-month[data-part="next-month"]Moves to the next month.
previous-year[data-part="previous-year"]Moves to the previous year.
next-year[data-part="next-year"]Moves to the next year.
grid[data-part="grid"]Groups cells into a navigable two-dimensional structure.
cell[data-part="cell"]Represents one navigable or selectable grid value.
month-cell[data-part="month-cell"]Represents one selectable month.

Keyboard interaction

KeyBehavior
Arrow keysMove the highlighted date by one day or one week.
Home / EndMove to the start or end of the week.
Page Up / Page DownMove by one month; hold Shift to move by one year.
Enter / SpaceSelect the highlighted date.
EscapeClose the calendar without selecting another date.

Accessibility

Date and time inputs remain labeled while the popup calendar uses grid semantics and an explicit trigger.

Released under the MIT License.