ToggleButton
A toggle button
import { ToggleButton } from "@schukai/monster/source/components/host/toggle-button.mjs";Introduction
The monster-toggle-button is a specialized call button that invokes toggle() on a referenced element. It simplifies common toggle interactions.
Basic Usage
<monster-overlay class="toggle-target">Overlay content</monster-overlay>
<monster-toggle-button data-monster-reference=".toggle-target">
Toggle overlay
</monster-toggle-button>
Toggle Button
A toggle button that calls toggle() on a collapse element.
Javascript
import '@schukai/monster/source/components/host/toggle-button.mjs';
import '@schukai/monster/source/components/layout/collapse.mjs';HTML
<monster-collapse class="toggle-target" data-monster-option-labels-title="Section">
<div slot="content">Collapsible content</div>
</monster-collapse>
<monster-toggle-button data-monster-reference=".toggle-target">
Toggle section
</monster-toggle-button>Stylesheet
/** no additional stylesheet is defined **/Component Design
The toggle button inherits the call button structure and exposes the same part for styling.
control: Wrapper around the toggle button.
monster-toggle-button::part(control) {
display: inline-flex;
}
HTML Structure
<monster-toggle-button></monster-toggle-button>JavaScript Initialization
const element = document.createElement('monster-toggle-button');
document.body.appendChild(element);Exported
ToggleButtonDerived from
CallButtonOptions
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 CallButton.
- 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 CallButton.
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 CallButton.
Static methods
[instanceSymbol]()- {symbol}
instanceof operator.getTag()- {string}
Events
This component does not fire any public events. It may fire events that are inherited from its parent classes.