Agent integration guide
Use this route when integrating z-cal into a consumer application. For changes to z-cal itself, start with Contributing.
Integration sequence
- Check the installed version in the consumer's lockfile/package metadata. Use the matching
repository tag or installed declarations when its API differs from
main. - Read installation, then choose the vanilla or React
quickstart. Install
z-cal; React bindings arez-cal/reactwith React 19 peers. - Read configuration for the selected view, its required plugin, timezone,
container sizing, and optional resources. Specify
viewexplicitly. - Read events before wiring data sources or mutations. Decide who owns event data: application state, the instance's local store, or a remote source with persisted writes.
- For React, read props and lifecycle before adding refs, controller hooks, or slots. Keep unchanged event arrays stable; remount to change plugins.
- Verify the integration in the consumer: the calendar is styled, the intended view renders, example events appear at the expected time, and enabled interactions behave correctly.
API facts that prevent common mistakes
createCalendar(host, { plugins, options }); React takes options directly as props.heightis a CSS string. Percentage sizing needs a defined parent and host height.Interactionplusselectableenables selection; your application creates the event/form.Interactionpluseditableenables event dragging/resizing, subject to event overrides.businessHoursshades closed time; edits are only limited whendragConstraint,resizeConstraint, orselectConstraintis'businessHours'(or inline hours, an event id, or a predicate).eventOverlap: false/selectOverlap: falseblock overlapping edits and selections.- Dates returned by the API are Temporal values. All-day ends are exclusive.
updateEventreplaces the complete event input and requiresidandstart.- Recurring events need the
Recurrenceplugin. Pass the rule asrecurrence: { rrule }(RFC 5545 text) or object fields; do not pre-expand. Callbacks report occurrences withevent.occurrence(seriesId,key,index); a drop already recorded an override, andeditRecurringEvent(series, event, scope)returns the inputs to write back for a chosen scope. - Source refetches can replace local edits; persist before refetching. Replacing an
eventsprop can do the same. Stable IDs preserve identity, not persistence. responsiveWeekis opt-in and only affectstimeGridWeekand views derived from it.keyboardNavigation(arrow keys across cells, Enter, Shift+Arrow selection) andkeyboardShortcuts(t,j/k,d/w/m/a) are opt-in; enable them when the app needs grid-level keyboard access.- Popovers, inspectors, and selection UI belong to the application. Anchor them with
getEventElements(id)and decide dismissal frompointerDown(targetis'event','date', or'none';consume()makes a press that only dismisses do nothing else); do not query or stamp the calendar's DOM to recover what it rendered. - Custom content replaces that content region. Initials are not generated; add icons through renderers.
- Plain strings are text.
{ html }is trusted markup; use safe text/DOM/React content for untrusted data.
What the library owns and what the application owns
The engine owns the DOM nodes it creates and their identity, hit-testing and geometry, and gesture
facts such as what was pressed and what is in flight. The application owns what a press means for
its UI, how its data model maps onto events, and its popover or dialog library. When something the
calendar knew at render time is only recoverable by querying its DOM (closest, querySelector,
stamping attributes), that is a gap to report against z-cal rather than to work around; deciding
what to do with such a fact stays in the application.
Resolve uncertainty
Consult API reference for methods, exports, and callback contracts, then the source pointers there for exact option types and defaults. Prefer z-cal's declarations over APIs from another calendar library. Consult troubleshooting for missing views, stale props, Temporal errors, and layout issues. Solid and Svelte adapters are currently unavailable.
Completion checks
- The consumer's typecheck and build pass with actual
z-calimports. - CSS and Temporal initialization are loaded where required.
- The view's plugin is registered and the container has usable dimensions.
- A known all-day event and a known timed event display on the intended dates.
- Changes persist through the application's intended save/navigation/refetch flow.
- Custom forms have labels, keyboard dismissal, and appropriate focus management.