Renders a calendar into container and returns a CalendarApi. Throws a TypeError when container is not an element.
calendarDefinition
The widget definition (name BirchCalendar, tag birchui-calendar, factory and event list) for the framework adapters' generic factories. See Use it in your framework.
CALENDAR_EVENTS
The list of event names.
calendarStyles
The stylesheet as a string, for shadow roots or custom injection.
createCalendar<TEvent> is generic: pass your own event interface (extending CalendarEvent) and every payload, renderer argument and API return value is typed with it.
Pass options to createCalendar, or change them later with update(partial). Every option is optional. An invalid value logs one console warning and the default is used instead.
Subscribe with on(event, listener). A listener that throws is caught and reported with console.error, so it never breaks the calendar. In framework adapters the same events are on… props (React, Solid), kebab-case listeners (Vue), outputs (Angular), on handlers of the Svelte action, or kebab-case CustomEvents on a custom element.
Event
Payload
When
ready
{ start, end, view }
Once, in a microtask after createCalendar returns, with the initial range.
eventClick
{ event, occurrence, element, nativeEvent }
An event is clicked, or activated with Enter or Space.
eventDoubleClick
{ event, occurrence, element, nativeEvent }
An event is double-clicked.
eventDrop
EventDropPayload
An event is moved, before the change is applied. Includes delta.
eventResize
EventResizePayload
An event is resized, before the change is applied. Includes edge.
eventRemove
EventRemovePayload
An event is removed from the keyboard, before it is removed.
select
{ start, end, allDay, view }
A span of empty time or days is selected.
dateClick
{ date, allDay, view, nativeEvent }
Empty space or a day is clicked or activated.
viewChange
{ view, previousView }
The view type changed.
rangeChange
{ start, end, view }
The visible range changed (not fired for the initial range).
A "+N more" button is activated. preventDefault() suppresses the built-in popover.
loading
{ isLoading }
An eventSource request started or settled.
The change payloads (eventDrop, eventResize, eventRemove) share event, occurrence, isRecurring, a writable scope ('this' or 'all'), source ('pointer' or 'keyboard') and revert(). eventDrop and eventResize add start, end, allDay, oldStart, oldEnd and oldAllDay. See The change payload.
The root element has the class lq-cal, plus lq-theme-light or lq-theme-dark, lq-cal--auto-height with height: 'auto', lq-cal--loading while loading and lq-cal--dragging during a drag. Events have lq-cal-event with modifiers such as --all-day, --recurring, --editable, --invalid and --continues-before/--continues-after, and days have lq-cal-day with --today, --past, --weekend, --non-business and --other-month. Theme through the shared --lq-* tokens and the calendar tokens such as --lq-cal-now, --lq-cal-nonbusiness, --lq-cal-today-bg and --lq-cal-shadow; see the theming guide.