Host
A simple host component
import { Host } from "@schukai/monster/source/components/host/host.mjs";Host content goes here.
Introduction
The monster-host component wraps an application shell and wires optional helpers like the config manager, overlay, and notifications. It provides a consistent container for app content.
Basic Usage
<monster-host>
<monster-config-manager></monster-config-manager>
<monster-notify></monster-notify>
<monster-overlay></monster-overlay>
<div>App content</div>
</monster-host>
Host Container
A minimal host container with overlay, notify, and config manager components.
Host content goes here.
Javascript
import '@schukai/monster/source/components/host/host.mjs';
import '@schukai/monster/source/components/host/config-manager.mjs';
import '@schukai/monster/source/components/notify/notify.mjs';
import '@schukai/monster/source/components/host/overlay.mjs';HTML
<monster-host>
<monster-config-manager></monster-config-manager>
<monster-notify></monster-notify>
<monster-overlay id="host-overlay">Overlay content</monster-overlay>
<div style="padding: 1rem;">
<p>Host content goes here.</p>
<button id="host-toggle">Toggle overlay</button>
</div>
</monster-host>Stylesheet
/** no additional stylesheet is defined **/Component Design
The host component provides a slot-based container. It does not impose layout styles; instead it focuses on coordinating helper components such as overlays, notifications, and configuration storage.
HTML Structure
<monster-host></monster-host>JavaScript Initialization
const element = document.createElement('monster-host');
document.body.appendChild(element);Exported
HostDerived from
CustomElementOptions
The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the CustomElement.
- since
- deprecated
Properties and Attributes
The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the CustomElement.
data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.data-monster-option-[name]: Sets the value of the configuration option[name]for the collapse component when used as an HTML attribute.
Methods
The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the CustomElement.
Behavioral methods
closeOverlay()- {Host}
{Error}There is no overlay element defined.
onReady()- {Promise}
openOverlay()- {Host}
{Error}There is no overlay element defined.
pushNotification(message)message{string|message}: message
toggleOverlay()- {Host}
{Error}There is no overlay element defined.
State query methods
hasConfig(key)key{string}: key
Structural methods
getConfig(key)key: key
- {Promise}
setConfig(key,value)key{string}: keyvalue{*}: value
- {Promise}
Static methods
[instanceSymbol]()- {symbol}
instanceof operator.getCSSStyleSheet()- {CSSStyleSheet[]}
getTag()- {string}
Lifecycle methods
Lifecycle methods are called by the environment and are usually not intended to be called directly.
[assembleMethodSymbol]()- {Host}
connectedCallback()Host#monster-host-connected
disconnectedCallback()Host#monster-host-disconnected
Other methods
deleteConfig(key)key{key}: key
focusManager()- {*}
locale()- {Locale}
resourceManager()- {*}
translations()- {Translations}
Events
The component emits the following events:
monster-host-connectedmonster-host-disconnectedHost#monster-host-connectedHost#monster-host-disconnected
For more information on how to handle events, see the mdn documentation.