Overview
Theapp-date-picker component provides a Material Design date picker with calendar and year grid views. It supports customizable date ranges, disabled dates, week numbers, and full keyboard navigation.
Installation
Import
Usage
Properties
Selected date in ISO 8601 format (yyyy-MM-dd), e.g.
2024-02-02. Can also accept full ISO format like 2024-02-02T00:00:00.000Z.Minimum selectable date. When not set or undefined, defaults to
1970-01-01. Accepts ISO 8601 format.Maximum selectable date. When not set or undefined, defaults to
2100-12-31. Accepts ISO 8601 format.ISO 639 language code for localization, e.g.
en-US, fr-FR, ja-JP. Defaults to system locale.First day of the week (0-6, where 0 is Sunday). Accepts values between 0 and 6 inclusive.
When true, displays a column of week numbers on the left side of the calendar.
How week numbers are calculated. Options:
first-4-day-week- ISO 8601 week numberingfirst-day-of-year- Week 1 starts January 1first-full-week- First complete week is week 1
Initial view to render. Options:
calendar or yearGrid.Comma-separated dates to disable. Accepts ISO 8601 format:
2024-02-02,2024-12-25.Comma-separated days of week to disable (0-6). Example:
0,6 disables weekends.Label Properties
Tooltip text for today’s date in the calendar.
Tooltip text for the selected date.
Tooltip for next month navigation button.
Tooltip for previous month navigation button.
Tooltip for year dropdown button in calendar view.
Tooltip for month dropdown button in year grid view.
Tooltip for selected year in year grid.
Tooltip for current year in year grid.
Tooltip for week number column header.
Abbreviated label for week number column header.
Template for week number tooltips.
%s is replaced with week number.Read-only Properties
Selected date as JavaScript Date object, e.g.
new Date('2024-02-02').Selected date in milliseconds since ECMAScript epoch.
Events
date-updated
Fires when the selected date changes.first-updated
Fires when the picker completes its first render.year-updated
Fires when the selected year changes in the year grid view.CSS Custom Properties
Theme Colors
Primary background color.
Text color on primary background.
Background color of picker surface.
Text color on surface.
State Colors
Border color for hover state.
Text color for hover state.
Border color for focus state.
Text color for focus state.
Text color for disabled state.
Border color when selected and hovered.
Text color when selected and hovered.
Border color when selected and focused.
Text color when selected and focused.
Today & Special States
Border color of today’s date.
Text color of today’s date.
Text color for weekday headers.
Text color for week numbers.
Sizing
Border radius of the picker.
Minimum width of picker.
Maximum width of picker.
Minimum height of picker.
Maximum height of picker.
CSS Shadow Parts
Use::part() to style internal elements:
Available Parts
header- Picker header containing month/year selectorbody- Picker body (calendar or year-grid)calendar- Calendar containertable- Calendar tablecaption- Calendar captionweekdays- Weekday headers rowweekday- Individual weekday header cellweekday-value- Weekday text contentweek-number- Week number cellcalendar-day- Calendar day celltoday- Today’s dateyear-grid- Year grid containeryear- Year buttontoyear- Current year
Keyboard Navigation
Calendar View
- Arrow Keys - Navigate between dates
- Home - First day of current week
- End - Last day of current week
- Page Up - Previous month
- Page Down - Next month
- Alt + Page Up - Previous year
- Alt + Page Down - Next year
- Enter / Space - Select focused date
- Tab - Move to next focusable element
Year Grid View
- Arrow Keys - Navigate between years
- Home - First year in range
- End - Last year in range
- Enter / Space - Select year and return to calendar