Skip to main content

Overview

app-datepicker is built with Material Design 2021 principles and uses CSS custom properties (CSS variables) for theming. The component renders within Shadow DOM, providing encapsulation while still allowing customization through CSS variables.
All styling is done through CSS custom properties, making it easy to theme the component without requiring deep CSS knowledge.

CSS Custom Properties

The component exposes a comprehensive set of CSS custom properties for theming:

Color Properties

From src/stylings.ts:5-25:

Primary Theme Colors

Interactive States

Special Elements

Theme Examples

Material Purple (Default)

Blue Theme

Green Theme

Dark Theme

Use the @media (prefers-color-scheme: dark) query to automatically switch themes based on user preferences.

Component-Specific Styling

Date Picker Dimensions

From src/date-picker/stylings.ts:4-11:

SVG Icons

Scrollbar Styling

The component includes custom scrollbar styling for webkit browsers:
From src/stylings.ts:89-119:

Shadow Parts

The component exposes Shadow Parts for advanced styling:

Date Picker Parts

From src/date-picker/date-picker.ts:157-158:

Responsive Styling

Complete Theming Example

Here’s a complete example with Lit showing custom theming:

Material Design 2021

The component follows Material Design 2021 principles:
  • Elevation: Uses flat design with subtle shadows
  • Typography: System fonts with appropriate sizing
  • Color System: Supports primary, surface, and state colors
  • Shape: Customizable border radius (default 4px)
  • Motion: Smooth transitions for interactive elements
The component uses overscroll-behavior: contain to prevent scroll chaining, providing a better user experience on mobile devices.

Accessibility Considerations

When styling, maintain sufficient color contrast:
Always test your color combinations for accessibility compliance. Use tools like the WebAIM Contrast Checker to verify contrast ratios.

Dynamic Theming

Change themes at runtime using JavaScript:

Next Steps

Advanced Features

Explore week numbers, disabled dates, and more

API Reference

View complete property and method documentation