Skip to main content

Overview

The app-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

Or import from specific path:

Usage

Properties

string
default:"today"
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.
string
default:"1970-01-01"
Minimum selectable date. When not set or undefined, defaults to 1970-01-01. Accepts ISO 8601 format.
string
default:"2100-12-31"
Maximum selectable date. When not set or undefined, defaults to 2100-12-31. Accepts ISO 8601 format.
string
default:"system default"
ISO 639 language code for localization, e.g. en-US, fr-FR, ja-JP. Defaults to system locale.
number
default:"0"
First day of the week (0-6, where 0 is Sunday). Accepts values between 0 and 6 inclusive.
boolean
default:"false"
When true, displays a column of week numbers on the left side of the calendar.
string
default:"first-4-day-week"
How week numbers are calculated. Options:
  • first-4-day-week - ISO 8601 week numbering
  • first-day-of-year - Week 1 starts January 1
  • first-full-week - First complete week is week 1
string
default:"calendar"
Initial view to render. Options: calendar or yearGrid.
string
default:""
Comma-separated dates to disable. Accepts ISO 8601 format: 2024-02-02,2024-12-25.
string
default:""
Comma-separated days of week to disable (0-6). Example: 0,6 disables weekends.

Label Properties

string
default:"Today"
Tooltip text for today’s date in the calendar.
string
default:"Selected date"
Tooltip text for the selected date.
string
default:"Next month"
Tooltip for next month navigation button.
string
default:"Previous month"
Tooltip for previous month navigation button.
string
default:"Choose year"
Tooltip for year dropdown button in calendar view.
string
default:"Choose month"
Tooltip for month dropdown button in year grid view.
string
default:"Selected year"
Tooltip for selected year in year grid.
string
default:"Toyear"
Tooltip for current year in year grid.
string
default:"Week"
Tooltip for week number column header.
string
default:"Wk"
Abbreviated label for week number column header.
string
default:"Week %s"
Template for week number tooltips. %s is replaced with week number.

Read-only Properties

Date
Selected date as JavaScript Date object, e.g. new Date('2024-02-02').
number
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

color
default:"#6200ee"
Primary background color.
color
default:"#fff"
Text color on primary background.
color
default:"#fff"
Background color of picker surface.
color
default:"#000"
Text color on surface.

State Colors

color
default:"#6200ee"
Border color for hover state.
color
default:"#000"
Text color for hover state.
color
default:"#000"
Border color for focus state.
color
default:"#000"
Text color for focus state.
color
default:"rgba(0, 0, 0, .38)"
Text color for disabled state.
color
default:"#6200ee"
Border color when selected and hovered.
color
default:"#fff"
Text color when selected and hovered.
color
default:"#000"
Border color when selected and focused.
color
default:"#fff"
Text color when selected and focused.

Today & Special States

color
default:"#000"
Border color of today’s date.
color
default:"#000"
Text color of today’s date.
color
default:"#8c8c8c"
Text color for weekday headers.
color
default:"#8c8c8c"
Text color for week numbers.

Sizing

dimension
default:"4px"
Border radius of the picker.
dimension
default:"calc((16px * 2) + (32px * 7))"
Minimum width of picker.
dimension
default:"calc((16px * 2) + (32px * 7))"
Maximum width of picker.
dimension
default:"calc(52px + 4px + (32px * 7))"
Minimum height of picker.
dimension
default:"calc(52px + 4px + (32px * 7))"
Maximum height of picker.

CSS Shadow Parts

Use ::part() to style internal elements:

Available Parts

  • header - Picker header containing month/year selector
  • body - Picker body (calendar or year-grid)
  • calendar - Calendar container
  • table - Calendar table
  • caption - Calendar caption
  • weekdays - Weekday headers row
  • weekday - Individual weekday header cell
  • weekday-value - Weekday text content
  • week-number - Week number cell
  • calendar-day - Calendar day cell
  • today - Today’s date
  • year-grid - Year grid container
  • year - Year button
  • toyear - 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

Example: JavaScript Integration

TypeScript