Skip to main content

Component Variants

app-datepicker provides three main component variants, each optimized for different use cases:

date-picker

Standalone calendar picker component

date-picker-dialog

Calendar picker inside a modal dialog

date-picker-input

Text field with integrated calendar picker

Installation

Importing Components

Basic Date Picker

The app-date-picker component renders a standalone calendar interface.

Date Picker Dialog

The app-date-picker-dialog wraps the calendar in a Material Design dialog with action buttons.
The dialog component requires Material Web Components (@material/mwc-dialog and @material/mwc-button) as peer dependencies.

Date Picker Input

The app-date-picker-input provides a text field that opens a calendar picker when clicked.
The input component extends Material Web Components’ TextField, inheriting all its styling and functionality.

Setting Values

All components share the same value interface:
The value property must be in YYYY-MM-DD format. Setting null or empty string resets to the last valid date. To reset to today’s date, set value = undefined.

Common Properties

These properties are available on all three components:

Date Range

Start View

From src/constants.ts:22:

Week Numbers

Event Handling

Date Updated Event

Fired when the user selects a date:
From src/typings.ts:18-23:

First Updated Event

Fired once when the component first renders:

Dialog-Specific Events

For app-date-picker-dialog only:

Input-Specific Events

For app-date-picker-input only:

Programmatic Control

Dialog Methods

Input Methods

Complete Example

Here’s a complete example using Lit:
Always use the .property=${value} syntax in Lit templates for boolean and object properties to ensure proper binding.

Next Steps

Localization

Learn how to localize the date picker for different languages and regions

Styling

Customize the appearance with CSS custom properties

Advanced Features

Explore disabled dates, week numbers, and custom formatters

API Reference

View complete API documentation