Calendar

Material Design 3 styled calendar and scheduler web component: month, week, day and agenda views with drag, resize and keyboard moves.

  • 15.2 KB gzipped
  • @lit-material/calendar 0.0.0
  • Renders on the server

Example

Install

npm install @lit-material/calendar @lit-material/tokens
import "@lit-material/calendar";

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

API

<lit-material-calendar>

Material Design 3 styled calendar and scheduler: a month grid, week and day time grids, and an agenda list, with a toolbar (previous / today / next, the period's title, and a view switch).

Properties

PropertyAttributeTypeDefaultDescription
viewviewCalendarView"month"Which view is shown.
datedatestring | undefinednoneThe day in focus, as an ISO "YYYY-MM-DD" string; the view shows the month, week or day around it. Default: today.
eventseventsCalendarEvent[][]The events: { id, title, start, end?, allDay?, color?, editable?, ...data }. Property or JSON attribute.
firstDayOfWeekfirst-day-of-weeknumber | undefinednone0 = Sunday, 1 = Monday, ... Default: the first day of the week in the element's language, else Sunday.
slotMinutesslot-minutesnumber30Minutes per row of the week and day views; also the step for keyboard moves.
scrollToHourscroll-to-hournumber8The hour the week and day views scroll to when they open.
dayMaxEventsday-max-eventsnumber3Event rows per day in the month view before "+N more".
agendaDaysagenda-daysnumber7Days the agenda view lists, from date.
readonlyreadonlybooleanfalseNo dragging, resizing or keyboard moves (clicks still fire).
visibleRangeproperty only{ start: Date; end: Date }noneThe first and (exclusive) last instant on screen.

Events

EventDescription
navigatedetail: { view, date, start, end } when the toolbar, keyboard or a "+N more" link changes the view or the period shown.
slot-clickdetail: { start, end, allDay } when an empty day, all-day cell or time slot is clicked or activated, or a time range is dragged out (pointer) or extended with Shift+arrows.
event-clickdetail: { event } when an event is clicked or activated with Enter/Space.
event-changeCancelable. detail: { event, start, end, allDay } when an event is dragged, resized or moved with the keyboard. The app updates events.

CSS parts

PartDescription
toolbarThe row with the navigation buttons, title and view switch.
titleThe period's title.
viewsThe view switch (a segmented button group).
gridThe month grid or the time grid.
agendaThe agenda list.
eventEach event chip.

CSS custom properties

PropertyDescription
--lit-material-calendar-slot-heightHeight of one time slot in the week and day views. Default 24px.
--lit-material-calendar-heightMaximum height of the scrolling time grid. Default 640px.

Source on GitHub npm