Skip to content
Slotted

Datetime Picker

A segmented date and time field with a calendar and a clock behind one trigger, for one moment that the reader can type or choose.

mm
dd
yyyy
hh
mm
AM

Type the date and time, or choose them from the calendar and the list.

Installation

The packages are a 0.x beta on npm, and their public API changes between beta releases without deprecation. One line installs the binding and the default theme.

bash
pnpm add @slotted/react @slotted/theme @slotted/themes
tsx
import { DateTimePicker, DateTimePickerDefaultsProvider } from '@slotted/react';

Typing or choosing

The field and the panel write the same value. Type the month, day, year, hour and minute into the segments, or press the calendar button, choose a day in the calendar and a time in the clock, and press Apply. The time can also be typed at the head of the clock. Each change reports its reason: keyboard for typing, select for a moment applied from the panel, clear for the clear button and blur for a value completed when the field loses focus. Press +, - or = on a segment to type a relative expression instead, such as +2h or +1d, measured from referenceDateTime.

09
30
2026
02
30
PM

No change yet.

Completing the value

The panel holds a draft: a day and a time are two presses, and Apply writes both and closes the panel. Apply stays disabled while a half is missing. A day pressed with no time moves focus to the clock. Escape and a press outside leave the value as it was. referenceDateTime states the moment it is: the month an empty panel opens on, the distance written over the clock, and what Now and the steps from now count from. Unset, it is the current time.

mm
dd
yyyy
hh
mm
AM

The panel opens on October 1 and counts its steps from 3:00 PM.

12-hour and 24-hour clocks

hourCycle takes 12 or 24 and applies to the field, the clock and the date and time in words. Unset, the locale decides: en-US writes 12-hour times with AM and PM, en-GB and de-DE write 24-hour times.

09
30
2026
06
45
PM
09
30
2026
18
45

Step between times

step sets the seconds between two times in the clock, 900 by default. The clock counts from the earliest time the day allows: the time of min on its own day, minTime on the other days, and midnight when neither is set. A step of 1800 from a minTime of 7:15 AM offers 7:15, 7:45 and 8:15. The step applies to the clock only: the field accepts any minute by typing and by the arrow keys.

mm
dd
yyyy
hh
mm
AM

Appointments start every 30 minutes from 7:15 AM.

Hours, minutes or seconds

granularity sets how much of the time the field and the clock write: hour, minute (the default) or second. With second, the clock adds a grid of seconds under the minutes.

10
01
2026
06
AM

Shifts start on the hour.

09
30
2026
02
00
30
AM

The nightly run starts between 2:00:00 and 2:05:00 AM.

Stated times

options replaces the step with your own list of times, for a schedule that no step describes, such as departures or delivery windows. The clock draws whole times under the part of the day each one is in, in the order you give. The bounds and the predicates still refuse times in it, and there is no Now and no step from now.

mm
dd
yyyy
hh
mm
AM

The Chicago to Memphis trailer leaves five times a day.

Earliest and latest

Two pairs of bounds apply together. min and max are whole date-times: where the range starts and where it ends. minTime and maxTime bound the times of every day inside the range. On the first day the clock starts at the time of min, on the last day it stops at the time of max, and the calendar disables the days outside the range. A value outside the bounds stays in the field and marks the datetime picker invalid.

10
01
2026
01
00
PM

From October 1 at 1:00 PM to October 9 at 12:00 PM, between 8:00 AM and 5:00 PM.

Unavailable dates and times

isDateUnavailable receives each date and returns true for a day the reader cannot choose; the calendar disables it and its clock offers no time. isTimeUnavailable receives a time and the date it belongs to, so the rule can differ by day. The clock follows the day in the draft, and refused hours and minutes stay in place, disabled.

mm
dd
yyyy
hh
mm
AM

Weekdays from 8:00 AM to 5:00 PM, closed for lunch at noon.

Time zones and wall-clock values

The value is a PlainDateTime: a date and a time with no time zone, the time a clock on the wall shows. toISODateTime writes it as 2026-09-30T14:00:00, the format of input[type=datetime-local], and parseISODateTime reads it back. When your server stores instants, wallClockIn from @slotted/core/date converts an instant to the wall-clock time in a time zone; converting back to an instant stays in your application. timeZone decides which day the calendar marks as today and what the Now shortcut writes. Stated, the zone is written over the clock. Unset, both come from the browser’s time zone. today states the day itself, such as a business date: Now keeps the time of the clock on that day.

09
30
2026
02
00
PM

Today and Now follow the clock in Chicago.

Value: 2026-09-30T14:00:00, with no offset

Locale and format

locale takes a BCP 47 tag and sets the order of the segments, their separators and placeholders, the clock, the month and weekday names in the calendar, and the date and time in words that the calendar button announces. There is no format string: each locale writes its own shape. Unset, the locale comes from SlottedProvider in React or provideSlotted in Angular, and falls back to en-US. The value is the same PlainDateTime in every locale.

09
30
2026
02
30
PM
30
09
2026
14
30
30
09
2026
14
30
2026
09
30
14
30

Sizes

size sets the field and the trigger to one step of the control scale: sm for toolbars and filter rows, md for most forms, lg for sparse forms. Inside a field, an unset size follows the field.

09
01
2026
12
00
AM
09
30
2026
09
00
AM
11
02
2026
10
00
AM

Variants

outline is the default frame. subtle fills the control, for a form on a tinted surface. plain draws no frame at rest, for a table cell or a toolbar, and still shows hover and focus.

09
30
2026
09
00
AM
09
30
2026
09
00
AM
09
30
2026
09
00
AM

States

Set invalid, readOnly and disabled on the field, which passes them to the datetime picker; each can also be set on the datetime picker itself. Invalid draws the frame and the focus ring in the danger tone and sets aria-invalid. Read-only keeps the value legible and focusable. Read-only and disabled both disable the calendar button, so the panel cannot open.

09
29
2026
04
00
PM

Error:The pickup is before the order was placed, September 30 at 9:00 AM.

09
30
2026
09
00
AM

Set when the order was placed.

mm
dd
yyyy
hh
mm
AM

Filled in by the carrier on delivery.

Controlled

Pass value and update it from onValueChange in React, or bind [value] and update it from (valueChange) in Angular, when other parts of the screen depend on the value. The handler receives a PlainDateTime, or null while the field is empty or holds only one half. Buttons outside the datetime picker can set the value; the field and the panel follow.

10
01
2026
09
00
AM

Call on October 1, 2026 at 9:00 AM.

Clearing

clearable adds a clear button to the field while it holds any part of a value, and Clear to the footer of the panel. The button empties both halves, reports null with the reason clear and returns focus to the field. With required, neither is drawn.

10
09
2026
05
00
PM

Clear the date and time to release the shipment.

The panel keeps a draft until Apply, and Clear, with clearable, empties it. confirm={false} in React, or confirm="false" in Angular, drops Apply: each press on a whole moment writes it, and the press on the finest unit closes the panel. footer in React and an element with slDateTimePickerFooter in Angular set the text beside the actions; unset, it names the step.

In a form

name adds a hidden input that submits the value as an ISO string, such as 2026-10-01T08:00:00, whether it was typed or chosen. In Angular, the datetime picker is a form control: formControlName, formControl and ngModel bind the value, Validators.required applies to it, and the datetime picker reports slottedDateTimeRange outside min and max, slottedDateTimeWindow outside minTime and maxTime, slottedDateTimeUnavailable for a refused date or time and slottedDateTimeIncomplete while only one half is typed. In React, the value stays in your state and you validate it on submit. Submit without a value to see the required error, type a date in September to see the bound error, then reset.

mm
dd
yyyy
hh
mm
AM

Error:

Keyboard and the trigger’s name

Alt+ArrowDown opens the panel from the field and leaves focus in the field, so typing keeps working. The calendar button opens it with Enter, Space or ArrowDown and moves focus to the chosen day. Tab and Shift+Tab move between the shortcuts, the calendar, the clock and the footer until the panel closes. In the clock, the arrow keys move between hours and between minutes, and Home and End move to the first and last one. Enter or Space chooses, and Ctrl+Enter applies. Escape closes the panel, discards the draft and returns focus to the calendar button; while the calendar shows months or years, Escape first returns to the days. The button’s accessible name carries the chosen date and time, and messages replaces it: choose while no value is set and change, with the value in its {date} slot, once one is. onOpenChange in React and (openChange) in Angular report why the panel opened or closed.

09
30
2026
04
30
PM

Focus the field and press Alt+ArrowDown.

Narrow screens

Under 760 pixels, the panel shows the month or the clock, one at a time. The day and the time stay written at the head of each, and a press on a head brings its part; a press on a day moves to the clock. The shortcuts become a strip. Under 480 pixels on a touch screen, the panel opens as a sheet attached to the bottom of the viewport, and the positioner carries data-presentation="sheet".

mm
dd
yyyy
hh
mm
AM

Carrier pickup slot

A carrier collects in four fixed windows on weekdays, and each window takes three trucks. options lists the windows, isTimeUnavailable refuses a full window on its own day, and renderSlot in React or an ng-template with slClockSlot in Angular writes the trucks left in each one. The slot receives the time, its label, its state and the day in the draft. The button keeps its role, its states and its keyboard; only its content is yours.

mm
dd
yyyy
hh
mm

Harbor Freightways collects on weekdays. Each window says the trucks left.

Publish at a set time

A price list goes live at a set time in New York. min stops the reader before the moment the form opened, presets adds the two times the team uses most after Now, and timeZone makes today and Now follow New York. The value stays a wall-clock time; the description names the zone, so the reader and your server read it the same way.

10
01
2026
09
00
AM

Prices go live on October 1, 2026 at 9:00 AM, New York time.

Accessibility

KeyEffectFocus
Alt+ArrowDownopenstays in the field, so typing keeps working
ArrowDownthe trigger opens the panelthe chosen day, or today
ArrowUpthe trigger opens the panelthe chosen day, or today
Ctrl+Enterapply—
Escapeclosetrigger
Tabcontained—
  • The trigger says aria-haspopup="dialog" and its name carries the value written, which is where focus returns when the panel closes.
  • The panel is a dialog with its Tab wrapped, and each grid inside it is one stop.
  • Escape discards the draft and returns focus to the trigger. Ctrl+Enter applies from anywhere in the panel.
  • The footer’s hint is a status region, so the reason Apply is off is spoken as well as drawn.
  • Alt+ArrowDown opens the panel and leaves focus in the field, so the segments keep every key they had.
  • The clock answers the day in the draft, so a reader who moves to a closed day hears its hours as unavailable before they choose one.
  • Under 760 pixels each head is a button with aria-expanded, so the part that is not on screen is announced as collapsed and not as missing.

API

DateTimePicker

Props

valuePlainDateTime | null
The moment held. Present means the consumer owns it.
defaultValuePlainDateTime | nullDefault null
What it starts from, and returns to on a form reset. Read once.
minPlainDateTime
The earliest accepted moment.
maxPlainDateTime
The latest accepted moment.
minTimePlainTime
The earliest time of every day inside the range.
maxTimePlainTime
The latest time of every day inside the range.
isDateUnavailable(date: PlainDate) => boolean
Refuses particular dates.
isTimeUnavailable(time: PlainTime, date: PlainDate) => boolean
Refuses particular times of a day.
stepnumberDefault 900
Seconds between two offered times, counted from the first of the day.
optionsreadonly PlainTime[]
The times there are, stated rather than stepped.
presetsreadonly PickerPreset<PlainDateTime>[]
The consumer’s own shortcuts, after Now.
offsetsreadonly number[]Default [3600, 14400, 86400]
Steps from now, in seconds. An empty list draws none.
confirmbooleanDefault true
Whether the panel keeps a draft until Apply.
granularity'hour' | 'minute' | 'second'Default minute
The finest unit written.
hourCycle12 | 24Default the locale’s
The clock the moment is written on.
referenceDateTimePlainDateTimeDefault now
The moment it is: what an empty field steps from, and what the panel counts distances and steps from.
relativebooleanDefault true
Whether + and - open the duration expression in the field.
weekNumbersbooleanDefault false
Draws the ISO week number.
firstDayOfWeeknumberDefault the locale’s
0 is Sunday.
calendar'gregory'Default gregory
The calendar system.
namestring
The name a form posts the moment under.
invalidboolean
Stated by the consumer; a moment that fails a rule is invalid without it.
openboolean
Whether the panel is showing. Present means the consumer owns it.
defaultOpenbooleanDefault false
Whether it starts open when nobody else says. Read once.
placement'bottom-start' | 'bottom' | 'bottom-end' | 'top-start' | 'top' | 'top-end'Default bottom-start
Where the panel opens, before the positioner has read the room.
size'sm' | 'md' | 'lg'Default md
The height of the control. The field around it answers when the picker does not.
variant'outline' | 'subtle' | 'plain'Default outline
How the control draws its frame.
localestringDefault the language in force
BCP 47. Writes the field, the panel and the trigger’s name.
timeZonestringDefault the runtime’s
Which zone answers "what is now".
todayPlainDateDefault the clock’s
The day it is: the mark of today, the date of Now, and the empty panel’s month.
disabledboolean
Answers no key and no press.
readOnlyboolean
Readable and not changeable.
requiredboolean
The form needs a value.
clearablebooleanDefault false
Draws a clear on the control and in the panel, unless required.
messagesPartial<DatetimePickerMessages>
Words laid over the language in force: the trigger’s names, and what is said of a refused moment.

Events

NamePayloadWhen
onValueChange(value: PlainDateTime | null, request: ChangeRequest<PlainDateTime | null>)Before the value moves, and cancellable: from a key in the field, from Apply, from Clear.
onOpenChange(open: boolean, request: ChangeRequest<boolean>)Before the panel opens or closes, with the reason.

Composition

DateTimePickerDefaultsProvidercomponent
On applicationSets calendar, confirm, granularity, hourCycle, placement, size, step, timeZone, today and variant once.
footerReactNodeDefault the step
What the footer says when nothing is wrong.
renderSlot(state: ClockSlotState) => ReactNodeDefault the time
What one whole time of options draws.
render(props: DateTimePickerRootProps) => ReactNode
Substitutes the element the root renders.
refRef<DateTimePickerHandle>
focus(), open() and close().

Parts

PartElementRequiredPurpose
rootdiv, or the element render returnsYesThe frame of the picker. Carries data-ui="datetime-picker", data-granularity, data-size, data-variant, data-open and the state attributes.
controldivYesThe box the panel hangs from, around the field and the trigger.
triggerbuttonYesThe button that opens the panel. Its name carries the moment written.

Theming

Each token is a CSS custom property: set it in a theme, or on any element to retune every datetime picker inside it.

Datetime Picker tokens

TokenDefault
--slotted-datetime-picker-invalid-focus-ring-colorvar(--slotted-focus-ring-color-invalid, Highlight)
--slotted-datetime-picker-radiusvar(--slotted-control-radius, 4px)
--slotted-datetime-picker-trigger-active-backgroundvar(--slotted-tone-secondary-subtle-active)
--slotted-datetime-picker-trigger-colorvar(--slotted-text-muted, GrayText)
--slotted-datetime-picker-trigger-hover-backgroundvar(--slotted-tone-secondary-subtle-hover)
--slotted-datetime-picker-trigger-sizemin( calc(var(--_icon-size) + 2 * var(--slotted-space-2, 0.25rem)), calc( var(--_height) - var(--slotted-control-border-width, 1px) * 2 - var(--slotted-space-2, 0.25rem) ) )

Theme tokens it reads

TokenDefault
--slotted-control-border-widthvar(--slotted-border-width-thin)
--slotted-control-height-lgcomfortable 38px · compact 32px · dense 30px
--slotted-control-height-mdcomfortable 34px · compact 28px · dense 26px
--slotted-control-height-smcomfortable 30px · compact 26px · dense 24px
--slotted-control-icon-size-lgcomfortable 18px · compact 16px · dense 14px
--slotted-control-icon-size-mdcomfortable 16px · compact 14px · dense 13px
--slotted-control-icon-size-smcomfortable 14px · compact 13px · dense 12px
--slotted-control-radiusvar(--slotted-radius-sm)
--slotted-control-transition-durationvar(--slotted-duration-short)
--slotted-control-transition-easingvar(--slotted-easing-standard)
--slotted-disabled-foregroundSet per scheme by the theme
--slotted-focus-ring-colorSet per scheme by the theme
--slotted-focus-ring-color-invalidSet per scheme by the theme
--slotted-focus-ring-offsetvar(--slotted-border-width-thick)
--slotted-focus-ring-widthvar(--slotted-border-width-thick)
--slotted-space-20.25rem
--slotted-target-comfortable44px
--slotted-target-min24px
--slotted-text-mutedSet per scheme by the theme
--slotted-tone-secondary-subtle-activeSet per scheme by the theme
--slotted-tone-secondary-subtle-hoverSet per scheme by the theme