Minimal calendar mount
experimental
Mount a WarCalendar into a host element with no options and get a default month view.
Live example
Expected behavior
Mount renders the month of the current date inside the host. The JSON panel lists every resolved default. Unmount removes all calendar DOM and the host returns to its empty outline.
Source
import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(document.querySelector('#host'));
calendar.mount();
console.log(calendar.defaults);
calendar.unmount();import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(document.querySelector('#host'));
calendar.mount();
console.log(calendar.defaults);
calendar.unmount();import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(document.querySelector('#host'));
calendar.mount();
console.log(calendar.defaults);
calendar.unmount();import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(document.querySelector('#host'));
calendar.mount();
console.log(calendar.defaults);
calendar.unmount();// JavaScript module for Blazor interop
import { WarCalendar } from '@warlockcode/warui';
const calendar = new WarCalendar(document.querySelector('#host'));
calendar.mount();
console.log(calendar.defaults);
calendar.unmount();API reference
| Kind | Name | Type | Description |
|---|---|---|---|
| Function | new WarCalendar | (el: HTMLElement | string, options?: WarCalendarOptions) => WarCalendar | Creates an unmounted calendar for an element or a selector. Throws a descriptive error for null or unmatched targets. Existing children of the host are preserved. |
| Method | mount | () => void | Renders one root with class war-calendar (role region, aria-label "Calendar"). A second call is ignored and warns once in development mode. |
| Method | unmount | () => void | Removes the calendar root and all of its DOM. |