Installation
@flexilla/collapse
package. You can skip this step if you’ve already installed the full @flexilla/flexilla
package. Structure
Collapse Structure
- Collapse: The main container for collapsible content.
- Trigger (optional): An element used to toggle the collapse.
Example
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Initializing the Component
Collapse
component and initialize it with the desired options. Multi-Trigger
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Close height
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Laboriosam, dolorum, incidunt facilis quasi non ea mollitia odio, iure adipisci
Attributes
data-attributes
to manage state. Each time an action is triggered, the targeted element updates its data-attribute
. Data State: data-state
data-state
attribute stores the state of each item and is applied to the collapsible element. This can be useful for targeting specific states with CSS. -
open
: Indicates that the content is fully expanded. -
close
: Indicates that the content height or width is set to0
.
Aria Expanded: aria-expanded
true
or false
to indicate whether the content is expanded or collapsed. Props/Params & Options
Params
HTMLElement
. HTMLElement
. With JavaScript
With TypeScript
Options
data-attributes
. View examples here to learn how. isExpanded
property indicates whether the element is expanded or collapsed. Methods
Show/Expand
Hide
Toggle
Auto Init
autoInit
method initializes all collapse elements. This method accepts a string to identify the elements (using a class name or data attribute). By default, it uses [data-fx-collapse]
.