Collapse Component
The Collapse component is used to hide and show an element.
Params
| collapseElement | The element to be collapsed/expanded | HTMLElement |
| triggerElement | The element that triggers the collapse | HTMLElement | null |
| options | Additional options for the Collapse | CollapseOptions |
CollapseOptions
| orientation | The orientation of the collapse | "vertical" | "horizontal" | "vertical" |
| defaultState | The default state of the collapse | "open" | "close" | "close" |
Example
const options = {
orientation: "vertical",
defaultState: "close",
};
const collapse = new Collapse(
'#myCollapseElement',
options,
'#myTriggerElement',
);
collapse.show();
collapse.hide();
collapse.toggle();