WarUI documentation

Shell regions

experimental

The calendar shell has four regions in a fixed order: header, toolbar, body and footer.

Live example

Expected behavior

Each region is outlined and labelled. Injected content appears only in its region. Replacing the header swaps the default title for custom markup while the other regions stay unchanged.

Source

import { WarCalendar } from '@warlockcode/warui';

const calendar = new WarCalendar(host, {
  footerContent: 'Legend',
  toolbarContent: filterButton,
  renderRegion: ({ region }) => (region === 'header' ? 'Custom header' : undefined),
});
calendar.mount();
calendar.getRegionElement('footer');

API reference

CALE-A01-F02 API
KindNameTypeDescription
MethodgetRegionElement(name: 'header' | 'toolbar' | 'body' | 'footer') => HTMLElement | nullReturns the live element of a region (class war-calendar__<region>, data-region attribute) or null for an unknown or hidden region.
MethodsetOptions(options: WarCalendarOptions) => voidUpdates headerContent, toolbarContent, footerContent (text or node appended to the region) and renderRegion (replaces default content; null hides the region; a thrown error emits an error event and falls back to the default).
Methodon(type: keyof WarCalendarEventMap, listener: (detail) => void) => () => voidSubscribes to the error and regionvisibilitychange events.