TimePicker
TimePicker is a standalone time selection surface. TextField uses it automatically for type="time".
Anatomy
| Element | Part | Selector |
|---|---|---|
<div> | root | [data-scope="time-picker"][data-part="root"]LMBCopy |
<div> | surface | [data-scope="time-picker"][data-part="surface"]LMBCopy |
<header> | header | [data-scope="time-picker"][data-part="header"]LMBCopy |
<div> | title | [data-scope="time-picker"][data-part="title"]LMBCopy |
<div> | displayconditional | [data-scope="time-picker"][data-part="display"]LMBCopy |
<button> | hour-display | [data-scope="time-picker"][data-part="hour-display"]LMBCopy |
<span> | display-separator | [data-scope="time-picker"][data-part="display-separator"]LMBCopy |
<button> | minute-display | [data-scope="time-picker"][data-part="minute-display"]LMBCopy |
<div> | period-selectorconditional | [data-scope="time-picker"][data-part="period-selector"]LMBCopy |
<button> | period-option | [data-scope="time-picker"][data-part="period-option"]LMBCopy |
<div> | clockconditional | [data-scope="time-picker"][data-part="clock"]LMBCopy |
<div> | clock-face | [data-scope="time-picker"][data-part="clock-face"]LMBCopy |
<div> | clock-hand | [data-scope="time-picker"][data-part="clock-hand"]LMBCopy |
<button> | clock-option | [data-scope="time-picker"][data-part="clock-option"]LMBCopy |
<div> | inputs | [data-scope="time-picker"][data-part="inputs"]LMBCopy |
<label> | hour-input-field | [data-scope="time-picker"][data-part="hour-input-field"]LMBCopy |
<input> | hour-input | [data-scope="time-picker"][data-part="hour-input"]LMBCopy |
<span> | input-label | [data-scope="time-picker"][data-part="input-label"]LMBCopy |
<span> | input-errorconditional | [data-scope="time-picker"][data-part="input-error"]LMBCopy |
<span> | input-separator | [data-scope="time-picker"][data-part="input-separator"]LMBCopy |
<label> | minute-input-field | [data-scope="time-picker"][data-part="minute-input-field"]LMBCopy |
<input> | minute-input | [data-scope="time-picker"][data-part="minute-input"]LMBCopy |
<div> | actions | [data-scope="time-picker"][data-part="actions"]LMBCopy |
<IconButton> | mode-toggle | [data-scope="time-picker"][data-part="mode-toggle"]LMBCopy |
<span> | actions-spacer | [data-scope="time-picker"][data-part="actions-spacer"]LMBCopy |
Props
| Name | Description | Default | Control |
|---|---|---|---|
idOptional | Optional explicit id for the popover element. string | undefined | undefined | - |
variantOptional | Visual and positioning mode. Auto uses docked layout until a narrow/coarse pointer viewport. TimePickerVariant | undefined | "auto" | - |
anchorNameOptional | CSS anchor name used to position the docked popover. string | undefined | undefined | - |
anchorElementOptional | Element passed to showPopover as the source for focus and dismissal semantics. HTMLElement | undefined | undefined | - |
ariaLabelOptional | Accessible label for the picker surface. string | undefined | "Choose time" | |
titleTextOptional | Visible title. string | undefined | "Select time" | |
formatOptional | Clock format. TimePickerFormat | undefined | "12h" | - |
inputModeOptional | Initial input mode. If omitted, 12h starts in clock mode and 24h starts in keyboard mode. TimePickerInputMode | undefined | undefined | - |
confirmTextOptional | Text for the confirmation button. string | undefined | "OK" | |
cancelTextOptional | Text for the cancel button. string | undefined | "Cancel" | |
modelValueOptional | - TimePickerModelValue | - | - |
openOptional | - boolean | undefined | false |
Events5
| Name | Type | Description |
|---|---|---|
update:open | [value: boolean] | - |
cancel | [] | - |
update:modelValue | [value: TimePickerModelValue] | - |
change | [value: TimePickerModelValue] | - |
confirm | [value: TimePickerModelValue] | - |
Slots0
No slots documented.
Styling14
| Token | Description |
|---|---|
--md-time-picker-container-colorColorFallback var(--md-sys-color-surface-container-high) | Controls container color. |
--md-time-picker-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls container elevation. |
--md-time-picker-container-shapeShapeFallback var(--md-shape-overlay) | Controls container shape. |
--md-time-picker-container-widthLayoutFallback 22.5rem | Controls container width. |
--md-time-picker-clock-dial-container-colorColorFallback var(--md-sys-color-surface-container-highest) | Controls clock dial container color. |
--md-time-picker-clock-hand-colorColorFallback var(--md-sys-color-primary) | Controls clock hand and selected clock option color. |
--md-time-picker-clock-label-text-colorColorFallback var(--md-sys-color-on-surface) | Controls unselected clock option label color. |
--md-time-picker-clock-selected-label-text-colorStateFallback var(--md-sys-color-on-primary) | Controls selected clock option label color. |
--md-time-picker-selector-container-colorColorFallback var(--md-sys-color-surface-container-highest) | Controls time selector field container color. |
--md-time-picker-selector-selected-container-colorStateFallback var(--md-sys-color-primary-container) | Controls selected time selector field container color. |
--md-time-picker-selector-selected-label-text-colorStateFallback var(--md-sys-color-on-primary-container) | Controls selected time selector field label color. |
--md-time-picker-selector-unselected-label-text-colorColorFallback var(--md-sys-color-on-surface) | Controls unselected time selector field label color. |
--md-time-picker-period-selector-outline-colorColorFallback var(--md-sys-color-outline) | Controls AM/PM selector outline color. |
--md-time-picker-title-text-colorColorFallback var(--md-sys-color-on-surface-variant) | Controls title text color. |