packages/react-components/react-timepicker-compat/library/docs/Spec.md
Compat component for V8 TimePicker.
⚠️ A compat component is a component taken from v8 and partially updated with the v9 toolset while keeping its original functionality and most of the original API surface. The most noticeable change being the removal of all v8 dependencies and using only v9 dependencies. While this is a good first step, this is not the final v9 component. We are working on a fully fleshed v9 replacement that will follow all v9 patterns and conventions.
TimePicker offers a control that’s optimized for selecting a time from a drop-down list or using free-form input to enter a custom time.
TimePicker is built on top of v9 Combobox. Combobox Spec.md covers the variants, structure and accessibility of TimePicker. This spec highlights the TimePicker specifics.
When selecting a time, the time is validated, onTimeChange callback is fired with the selected time and the error if the time is invalid. TimePicker has two variants that provides different selection behavior:
onTimeChange callback.onTimeChange callback.onTimeChange is triggered with the selected time from input value. This behavior aligns with the native change event for text input.
freeform TimePicker's selection behavior is different from freeform Combobox. Combobox lacks the equivalent callback for native change event (29494)
See API at TimePicker.types.ts.
TimePicker share slots, visual and positioning props with Combobox. Its own specific props are:
defaultSelectedTime, selectedTime and onTimeChange.
formatDateToTimeStringstartHour, endHour and increment props are used to generate the predefined time options.hourCycle and showSeconds props. Further customization is available via formatDateToTimeString.