calendar-tsx

Concepts

The ideas the calendar is built on.

Controlled view and date

view and date are options you own, usually in component state or the URL. Navigation actions such as next() compute the next view and date and pass them to onNavigate; the calendar only changes when you pass them back in. See navigation.

Events are input

The calendar never stores or mutates events. Pass a new array to change them, filter the array to hide some, or use the optional event store.

One time zone

Every timed event is converted to the calendar's timeZone and laid out there, whatever the host's zone. All dates and times are Temporal values.

Derived state

The calendar derives a render model from its options: the view context (view, date, visible range), the layout for the active view and now. Components select the slice they need from it. The state re-derives only when a tracked option changes by reference, or the clock ticks, so keep views, features, events and resources stable between renders: define views at module scope and memoize arrays.

Views and layouts

A view is a key of your own (month, week, rooms) bound to one of four layouts: day grid, time grid, list or timeline. Every factory accepts day, week and month counts or calendar month, quarter and year periods. Day grids can group dates by month and resource; lists can group events by resource and date in either order. Several views can share a layout with different settings. You switch on layout.kind and render that layout's parts.

Unstyled parts

Parts render one element each, with data-* state attributes and their geometry as --cal-* custom properties. Style them with a theme or your own CSS. You format all visible text: the model carries Temporal values, never strings.

Features

Behavior beyond navigation and layout comes from features. Call each feature factory with its defaults, collect the results in calendarFeatures, and bind that registry to your views with calendarViews. Views inherit every registered feature and can override its configuration. View factories supply their layout features themselves.