Time Picker
Time Picker let the user select a time.
The selected time is indicated by the filled circle at the end of the clock hand.
Basic usage
The Time Picker is rendered as a modal dialog on mobile, and in the field on desktop.
Component composition
The Time Picker components are built using the TimeField
for the keyboard editing and the TimeClock
for the view editing.
All the documented props of those two components can also be passed to the Time Picker components.
Check-out their documentation page for more information:
Uncontrolled vs. Controlled
The component can be uncontrolled or controlled
Responsiveness
The Time picker Component is designed and optimized for the device it runs on.
- The
MobileNextTimePicker
component works best for touch devices and small screens. - The
DesktopNextTimePicker
component works best for mouse devices and large screens.
By default, the NextTimePicker
component renders the desktop version if the media query @media (pointer: fine)
matches.
This can be customized with the desktopModeMediaQuery
prop.
There are certain caveats when testing pickers, please refer to this section for more information.
Static mode
It is also possible to render any Time Picker without the modal/popover and text field. This will enable building custom popover/modal containers.
Views
The component can contain three views: hours
, minutes
, and seconds
.
By default, only the hours
and minutes
views are enabled.
You can customize the enabled views using the views
prop.
Views will appear in the order they're included in the views
array.
Landscape orientation
By default, the Time Picker automatically sets the orientation based on the window.orientation
value.
You can force a specific orientation using the orientation
prop.
Validation
You can find the documentation in the Validation page