Skip to main content

Quickstart

Get up and running with app-datepicker in minutes. This guide walks you through installation, basic setup, and common configuration patterns to have a beautiful Material Design datepicker working in your application quickly.

Installation

First, install app-datepicker using your preferred package manager:
The @next tag installs version 6.x (currently at RC 33), which is the actively developed version with the latest features and improvements.

Basic HTML usage

The simplest way to get started is with a CDN import. No build tools required:
1

Create an HTML file

Create an index.html file with this basic structure:
index.html
2

Add event handling

Listen for date selection and display the value:
index.html
3

Open in browser

Open the file in your browser and you’ll see a fully functional Material Design datepicker!

Usage with a bundler (npm/yarn/pnpm)

For production applications, use app-datepicker with a module bundler like Vite, Webpack, or Rollup.
1

Install dependencies

2

Import and use in TypeScript/JavaScript

3

Configure your bundler

Ensure your bundler is configured to handle ES modules. For Vite:
vite.config.js

Component variants

app-datepicker provides three component variants for different use cases:

date-picker

Inline calendar component for embedding directly in your UI

date-picker-input

Material Design text field with integrated datepicker dropdown

date-picker-dialog

Modal dialog containing the datepicker

Using date-picker-input

Perfect for form fields:

Using date-picker-dialog

Great for mobile experiences:

Common configuration patterns

Date constraints

Restrict selectable dates with min and max:

Disabling specific dates

Disable weekends and specific dates:
disabledDays: 0 = Sunday, 1 = Monday, …, 6 = SaturdaydisabledDates: Comma-separated list of dates in YYYY-MM-DD format

Internationalization

Set the locale for proper date formatting and first day of week:

Week numbers

Display ISO week numbers:

Start view

Control which view shows first - calendar or year grid:
The year grid view is perfect for date of birth pickers where users need to select a year first.

Event handling

All components emit these events:

date-updated

Fired when a date is selected:

first-updated

Fired once when the component first renders:

Complete working example

Here’s a complete example with multiple features:

Value formats

app-datepicker provides three ways to work with date values:
The value property must always be in YYYY-MM-DD format. Invalid formats will be rejected and the previous valid value will be retained.

Styling

Customize the appearance using CSS custom properties:

Next steps

Now that you have a working datepicker, explore more advanced features:

API Reference

Explore all properties, methods, and events for app-date-picker

Styling Guide

Learn how to customize colors, spacing, and themes

Input Component

Use the date picker with a Material Design text field

Dialog Component

Display the date picker in a modal dialog
Check out the live demo to see all features in action with configurable code snippets.