DatePicker
DatePicker is a standalone date surface. TextField uses it automatically for type="date" and type="datetime-local".
Anatomy
| Element | Part | Selector |
|---|---|---|
<div> | root | [data-scope="date-picker"][data-part="root"]LMBCopy |
<div> | surface | [data-scope="date-picker"][data-part="surface"]LMBCopy |
<div> | header | [data-scope="date-picker"][data-part="header"]LMBCopy |
<IconButton> | previous-month | [data-scope="date-picker"][data-part="previous-month"]LMBCopy |
<Button> | month-switch | [data-scope="date-picker"][data-part="month-switch"]LMBCopy |
<IconButton> | next-month | [data-scope="date-picker"][data-part="next-month"]LMBCopy |
<IconButton> | previous-year | [data-scope="date-picker"][data-part="previous-year"]LMBCopy |
<Button> | year-switch | [data-scope="date-picker"][data-part="year-switch"]LMBCopy |
<IconButton> | next-year | [data-scope="date-picker"][data-part="next-year"]LMBCopy |
<div> | calendarconditional | [data-scope="date-picker"][data-part="calendar"]LMBCopy |
<div> | weekdays | [data-scope="date-picker"][data-part="weekdays"]LMBCopy |
<span> | weekday | [data-scope="date-picker"][data-part="weekday"]LMBCopy |
<div> | grid | [data-scope="date-picker"][data-part="grid"]LMBCopy |
<button> | day | [data-scope="date-picker"][data-part="day"]LMBCopy |
<div> | months | [data-scope="date-picker"][data-part="months"]LMBCopy |
<button> | month | [data-scope="date-picker"][data-part="month"]LMBCopy |
<span> | list-icon | [data-scope="date-picker"][data-part="list-icon"]LMBCopy |
<span> | list-label | [data-scope="date-picker"][data-part="list-label"]LMBCopy |
<div> | years | [data-scope="date-picker"][data-part="years"]LMBCopy |
<button> | year | [data-scope="date-picker"][data-part="year"]LMBCopy |
<div> | actions | [data-scope="date-picker"][data-part="actions"]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. DatePickerVariant | 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 date" | |
minOptional | Earliest selectable date, formatted as YYYY-MM-DD. string | undefined | undefined | |
maxOptional | Latest selectable date, formatted as YYYY-MM-DD. string | undefined | undefined | |
localeOptional | BCP 47 locale used for month, weekday, and accessibility labels. string | undefined | undefined | - |
firstDayOfWeekOptional | First day of the week, where 0 is Sunday and 6 is Saturday. 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined | 0 | - |
confirmTextOptional | Text for the confirmation button. string | undefined | "OK" | |
cancelTextOptional | Text for the cancel button. string | undefined | "Cancel" | |
todayOptional | Date treated as today, formatted as YYYY-MM-DD. Useful for deterministic tests. string | undefined | undefined | - |
modelValueOptional | - DatePickerModelValue | - | - |
openOptional | - boolean | undefined | false |
Events5
| Name | Type | Description |
|---|---|---|
update:open | [value: boolean] | - |
cancel | [] | - |
update:modelValue | [value: DatePickerModelValue] | - |
change | [value: DatePickerModelValue] | - |
confirm | [value: DatePickerModelValue] | - |
Slots0
No slots documented.
Styling45
| Token | Description |
|---|---|
--md-date-picker-docked-container-colorColorFallback var(--md-sys-color-surface-container-high) | Controls docked container color. |
--md-date-picker-docked-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls docked container elevation. |
--md-date-picker-docked-container-shapeShapeFallback var(--md-shape-overlay) | Controls docked container shape. |
--md-date-picker-docked-container-widthLayoutFallback 22.5rem | Controls docked container width. |
--md-date-picker-docked-date-container-heightLayoutFallback 3rem | Controls docked date container height. |
--md-date-picker-docked-date-container-shapeShapeFallback var(--md-shape-indicator) | Controls docked date container shape. |
--md-date-picker-docked-date-container-widthLayoutFallback 3rem | Controls docked date container width. |
--md-date-picker-docked-date-label-text-fontTypographyFallback var(--md-sys-typescale-body-large-font) | Controls docked date label text font. |
--md-date-picker-docked-date-label-text-line-heightTypographyFallback var(--md-sys-typescale-body-large-line-height) | Controls docked date label text line height. |
--md-date-picker-docked-date-label-text-sizeLayoutFallback var(--md-sys-typescale-body-large-size) | Controls docked date label text size. |
--md-date-picker-docked-date-label-text-trackingTypographyFallback var(--md-sys-typescale-body-large-tracking) | Controls docked date label text tracking. |
--md-date-picker-docked-date-label-text-weightTypographyFallback var(--md-sys-typescale-body-large-weight) | Controls docked date label text weight. |
--md-date-picker-docked-date-selected-container-colorStateFallback var(--md-sys-color-primary) | Controls docked date selected container color. |
--md-date-picker-docked-date-selected-hover-state-layer-colorStateFallback var(--md-sys-color-on-primary) | Controls docked date selected hover state layer color. |
--md-date-picker-docked-date-selected-label-text-colorStateFallback var(--md-sys-color-on-primary) | Controls docked date selected label text color. |
--md-date-picker-docked-date-today-container-outline-colorColorFallback var(--md-sys-color-primary) | Controls docked date today container outline color. |
--md-date-picker-docked-date-today-container-outline-widthLayoutFallback 0.0625rem | Controls docked date today container outline width. |
--md-date-picker-docked-date-today-hover-state-layer-colorStateFallback var(--md-sys-color-primary) | Controls docked date today hover state layer color. |
--md-date-picker-docked-date-today-label-text-colorColorFallback var(--md-sys-color-primary) | Controls docked date today label text color. |
--md-date-picker-docked-date-unselected-hover-state-layer-colorStateFallback var(--md-sys-color-on-surface-variant) | Controls docked date unselected hover state layer color. |
--md-date-picker-docked-date-unselected-label-text-colorStateFallback var(--md-sys-color-on-surface) | Controls docked date unselected label text color. |
--md-date-picker-docked-date-unselected-outside-month-label-text-colorStateFallback var(--md-sys-color-on-surface) | Controls docked date unselected outside month label text color. |
--md-date-picker-docked-date-unselected-outside-month-label-text-opacityStateFallback 0.38 | Controls docked date unselected outside month label text opacity. |
--md-date-picker-docked-menu-button-container-shapeShapeFallback var(--md-shape-action) | Controls docked menu button container shape. |
--md-date-picker-docked-menu-button-label-text-colorColorFallback var(--md-sys-color-on-surface-variant) | Controls docked menu button label text color. |
--md-date-picker-docked-menu-button-label-text-fontTypographyFallback var(--md-sys-typescale-label-large-font) | Controls docked menu button label text font. |
--md-date-picker-docked-menu-button-label-text-line-heightTypographyFallback var(--md-sys-typescale-label-large-line-height) | Controls docked menu button label text line height. |
--md-date-picker-docked-menu-button-label-text-sizeLayoutFallback var(--md-sys-typescale-label-large-size) | Controls docked menu button label text size. |
--md-date-picker-docked-menu-button-label-text-trackingTypographyFallback var(--md-sys-typescale-label-large-tracking) | Controls docked menu button label text tracking. |
--md-date-picker-docked-menu-button-label-text-weightTypographyFallback var(--md-sys-typescale-label-large-weight) | Controls docked menu button label text weight. |
--md-date-picker-docked-menu-list-item-hover-state-layer-colorStateFallback var(--md-sys-color-on-surface) | Controls docked menu list item hover state layer color. |
--md-date-picker-docked-menu-list-item-label-text-colorColorFallback var(--md-sys-color-on-surface) | Controls docked menu list item label text color. |
--md-date-picker-docked-menu-list-item-label-text-fontTypographyFallback var(--md-sys-typescale-body-large-font) | Controls docked menu list item label text font. |
--md-date-picker-docked-menu-list-item-label-text-line-heightTypographyFallback var(--md-sys-typescale-body-large-line-height) | Controls docked menu list item label text line height. |
--md-date-picker-docked-menu-list-item-label-text-sizeLayoutFallback var(--md-sys-typescale-body-large-size) | Controls docked menu list item label text size. |
--md-date-picker-docked-menu-list-item-label-text-trackingTypographyFallback var(--md-sys-typescale-body-large-tracking) | Controls docked menu list item label text tracking. |
--md-date-picker-docked-menu-list-item-label-text-weightTypographyFallback var(--md-sys-typescale-body-large-weight) | Controls docked menu list item label text weight. |
--md-date-picker-docked-menu-list-item-selected-container-colorStateFallback var(--md-sys-color-surface-variant) | Controls docked menu list item selected container color. |
--md-date-picker-docked-menu-list-item-selected-leading-icon-colorStateFallback var(--md-sys-color-on-surface) | Controls docked menu list item selected leading icon color. |
--md-date-picker-docked-weekdays-label-text-colorColorFallback var(--md-sys-color-on-surface) | Controls docked weekdays label text color. |
--md-date-picker-docked-weekdays-label-text-fontTypographyFallback var(--md-sys-typescale-body-large-font) | Controls docked weekdays label text font. |
--md-date-picker-docked-weekdays-label-text-line-heightTypographyFallback var(--md-sys-typescale-body-large-line-height) | Controls docked weekdays label text line height. |
--md-date-picker-docked-weekdays-label-text-sizeLayoutFallback var(--md-sys-typescale-body-large-size) | Controls docked weekdays label text size. |
--md-date-picker-docked-weekdays-label-text-trackingTypographyFallback var(--md-sys-typescale-body-large-tracking) | Controls docked weekdays label text tracking. |
--md-date-picker-docked-weekdays-label-text-weightTypographyFallback var(--md-sys-typescale-body-large-weight) | Controls docked weekdays label text weight. |