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');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');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');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');// JavaScript module for Blazor interop
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
| Kind | Name | Type | Description |
|---|---|---|---|
| Method | getRegionElement | (name: 'header' | 'toolbar' | 'body' | 'footer') => HTMLElement | null | Returns the live element of a region (class war-calendar__<region>, data-region attribute) or null for an unknown or hidden region. |
| Method | setOptions | (options: WarCalendarOptions) => void | Updates 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). |
| Method | on | (type: keyof WarCalendarEventMap, listener: (detail) => void) => () => void | Subscribes to the error and regionvisibilitychange events. |