Date Range Picker

Material Design 3 modal or docked date picker and date range picker web components.

  • 5.6 KB gzipped
  • @lit-material/date-picker 0.1.0
  • Renders on the server

Example

Install

npm install @lit-material/date-picker @lit-material/tokens
import "@lit-material/date-picker";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-date-range-picker>

Material Design 3 date *range* picker — the two-endpoint sibling of lit-material-date-picker, sharing its calendar-grid rendering approach, keyboard navigation, and modal/docked variant split, but tracking a start/end pair instead of a single value.

Properties

PropertyAttributeTypeDefaultDescription
variantvariantDateRangePickerVariant"modal"
openopenbooleanfalseWhether a modal picker is open. Ignored for docked, which is always visible in-flow.
startstartstring | undefinednoneThe confirmed range start, as an ISO "YYYY-MM-DD" string.
endendstring | undefinednoneThe confirmed range end, as an ISO "YYYY-MM-DD" string.
minminstring | undefinednoneInclusive lower bound, as an ISO "YYYY-MM-DD" string.
maxmaxstring | undefinednoneInclusive upper bound, as an ISO "YYYY-MM-DD" string.
labellabelstring"Select dates"
firstDayOfWeekfirst-day-of-weeknumber00 = Sunday (default), 1 = Monday, ...

Events

EventDescription
closemodal only: re-dispatched from the native close event, after the dialog has closed.
cancelmodal only: re-dispatched from the native cancel event. Cancelable: calling preventDefault() stops the dialog from closing.
changeFires when a range is confirmed via "OK" and start/end actually changed.

CSS parts

PartDescription
dialogThe native <dialog> element. Only rendered for modal.
containerThe visible card.
headerThe label + selected-range headline.
navThe month navigation row (or the year-range label, in year mode).
calendarThe <table role="grid"> of day cells.
year-gridThe scrollable grid of years, in year mode.
actionsThe Cancel/OK row.

Source on GitHub npm