Region visibility toggles
experimental
Show or hide the header, toolbar and footer with options. Hidden regions are removed from the DOM.
Live example
Expected behavior
Unchecking a region removes it and the body grows to fill the freed space within the fixed 400px height. Re-checking restores it in its original position. The event log prints a regionvisibilitychange entry for each net change.
Source
import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(host, { showToolbar: false, showFooter: false });
calendar.on('regionvisibilitychange', ({ region, visible }) => {
console.log(region, visible);
});
calendar.mount();
calendar.setOptions({ showFooter: true });import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(host, { showToolbar: false, showFooter: false });
calendar.on('regionvisibilitychange', ({ region, visible }) => {
console.log(region, visible);
});
calendar.mount();
calendar.setOptions({ showFooter: true });import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(host, { showToolbar: false, showFooter: false });
calendar.on('regionvisibilitychange', ({ region, visible }) => {
console.log(region, visible);
});
calendar.mount();
calendar.setOptions({ showFooter: true });import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(host, { showToolbar: false, showFooter: false });
calendar.on('regionvisibilitychange', ({ region, visible }) => {
console.log(region, visible);
});
calendar.mount();
calendar.setOptions({ showFooter: true });// JavaScript module for Blazor interop
import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(host, { showToolbar: false, showFooter: false });
calendar.on('regionvisibilitychange', ({ region, visible }) => {
console.log(region, visible);
});
calendar.mount();
calendar.setOptions({ showFooter: true });API reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Method | setOptions | (options: { showHeader?: boolean; showToolbar?: boolean; showFooter?: boolean }) => void | Accepts showHeader, showToolbar and showFooter (default true). Rapid calls are batched into one layout pass per frame; showBody: false is ignored with a warning. If the focused region is removed, focus moves to the first focusable element of the body (or the body) and the change is announced politely. |
| Method | on | (type: 'regionvisibilitychange', listener: (detail: { region: RegionName; visible: boolean }) => void) => () => void | The regionvisibilitychange event reports { region, visible } for every net visibility change. |