Skip to main content

Overview

The app-date-picker-input component combines a Material Design text field with a dropdown date picker. It provides a text input that opens a calendar picker when clicked or focused.

Installation

Import

Or import from specific path:

Usage

Properties

Input-Specific Properties

string
default:"Clear"
Accessible label for the clear/reset icon button.
string
Label text displayed above/in the text field.
string
Helper text displayed below the input field.
boolean
default:"false"
Marks the field as required.
boolean
default:"false"
Disables the input field and picker.
boolean
default:"false"
Makes the input read-only (picker still works).

Inherited Properties

Inherits all properties from app-date-picker:
  • value - Selected date (string)
  • min - Minimum date (string)
  • max - Maximum date (string)
  • locale - Language code (string)
  • firstDayOfWeek - First day of week (number)
  • showWeekNumber - Show week numbers (boolean)
  • weekNumberType - Week calculation type (string)
  • startView - Initial view (string)
  • disabledDates - Disabled dates (string)
  • disabledDays - Disabled days (string)
  • All label properties
  • valueAsDate - Date object (readonly)
  • valueAsNumber - Timestamp (readonly)

Material TextField Properties

Also inherits properties from Material Web Components TextField:
  • outlined - Use outlined variant (boolean)
  • helperPersistent - Always show helper text (boolean)
  • validationMessage - Custom validation message (string)
  • name - Form field name (string)
  • autocapitalize - Auto-capitalization behavior (string)
  • inputMode - Input mode hint (string)

Methods

method
Programmatically opens the date picker dropdown.
method
Closes the date picker dropdown.
method
Clears the selected date and resets the input field.

Material TextField Methods

Also inherits methods from Material TextField:
  • layout() - Re-layout the text field
  • setCustomValidity(message) - Set custom validation message

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.

opened

Fires when the dropdown picker opens.

closed

Fires when the dropdown picker closes.

CSS Custom Properties

Inherits all CSS custom properties from app-date-picker plus Material TextField properties.

Input-Specific

color
default:"rgba(0, 0, 0, .54)"
Color of the clear/reset icon button.

Material TextField Properties

Customize the text field appearance:
  • --mdc-theme-primary - Primary color for labels and underline
  • --mdc-theme-error - Error state color
  • --mdc-text-field-fill-color - Background fill color
  • --mdc-text-field-disabled-fill-color - Disabled background color
  • --mdc-text-field-ink-color - Text color
  • --mdc-text-field-label-ink-color - Label color
  • --mdc-text-field-outlined-idle-border-color - Outlined variant border
  • --mdc-text-field-outlined-hover-border-color - Outlined hover border

CSS Shadow Parts

Inherits all shadow parts from app-date-picker:
  • header - Picker header
  • body - Picker body
  • calendar - Calendar container
  • calendar-day - Calendar day cells
  • today - Today’s date
  • year-grid - Year grid container
  • year - Year buttons
  • And all other calendar parts

Keyboard Navigation

Input Field

  • Click / Enter / Space - Open picker
  • Escape - Close picker
  • Tab - Move focus (closes picker if open)

Picker (when open)

  • Arrow Keys - Navigate dates
  • Enter / Space - Select date and close
  • Escape - Close without selecting
  • Tab - Close picker
See app-date-picker keyboard navigation for full calendar controls.

Example: Form Integration

Example: Styled Input

TypeScript

Behavior Notes

  • The input displays a formatted date (based on locale) while value remains in ISO format
  • The input is read-only by default; users select dates via the picker
  • Clicking the clear icon resets the value to empty
  • The picker lazy-loads when first opened for better performance
  • The dropdown stays open when clicking inside the picker
  • Pressing Enter or Space on a date closes the picker automatically
  • The component handles form validation and can be used with native form submission