CallButton
A trigger button that calls a documented method on one or more referenced elements.
import { CallButton } from "@schukai/monster/source/components/host/call-button.mjs";Introduction
The Monster CallButton triggers a method on another element through a simple declarative reference. Use it when one button should invoke a known public method such as open(), close() or toggle() without wiring a custom event handler.
When to use CallButton
- Use it for simple method wiring: Ideal for overlays, collapses and other controls with public methods.
- Use it when the relationship is explicit: The referenced target and called method should be easy to understand from the markup.
- Do not use it for arbitrary hidden behavior: If the interaction needs custom logic, regular JavaScript is usually clearer.
Call Button
A call button toggling a collapse element by calling its toggle method.
Javascript
import '@schukai/monster/source/components/host/call-button.mjs';
import '@schukai/monster/source/components/layout/collapse.mjs';<script type="module">import '@schukai/monster/source/components/host/call-button.mjs';
import '@schukai/monster/source/components/layout/collapse.mjs';</script>HTML
<monster-collapse class="call-target" data-monster-option-labels-title="Section">
<div slot="content">Collapsible content</div>
</monster-collapse>
<monster-call-button data-monster-reference=".call-target" data-monster-call="toggle">
Toggle section
</monster-call-button>Stylesheet
/** no additional stylesheet is defined **/Component Design
The call button renders a simple control wrapper and an anchor element. Customize it via the exported part.
control: Wrapper around the call button.
monster-call-button::part(control) {
display: inline-flex;
}
HTML Structure
<monster-call-button></monster-call-button>JavaScript Initialization
const element = document.createElement('monster-call-button');
document.body.appendChild(element);Exported
CallButtonDerived 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.
Static methods
[instanceSymbol]()- {symbol}
instanceof operator.getCSSStyleSheet()- {Array}
getTag()- {string}
Lifecycle methods
Lifecycle methods are called by the environment and are usually not intended to be called directly.
[assembleMethodSymbol]()- {CallButton}
Events
This component does not fire any public events. It may fire events that are inherited from its parent classes.