To be generated via JS.
Collapsibles are simple widgets that allow you to expand or collapse content when tapped and are useful in mobile to provide a compact presentation of content. Jump to section
To create a collapsible block of content, create a container and add the data-role="collapsible"
attribute. Directly inside this container, add any header (H1-H6) or legend element. The framework will style the header to look like a clickable button and add a "+" icon to the left to indicate it's expandable. After the header, add any HTML markup you want to be collapsible. The framework will wrap this markup in a container that will be hidden/shown when the heading is clicked.
I'm the collapsible content. By default I'm closed, but you can click the header to open me.
Add the data-content-theme
attribute to set a theme for the content of the collapsible. To provide a stronger visual connection between the collapsible header and content, add the data-content-theme
attribute to the wrapper and specify a theme swatch letter. This applies the swatch's border and flat background color (not the gradient) to the content block, removes the rounded corners from the bottom of the header, and gives the bottom of the content block rounded corners to visually group these elements.
I'm the collapsible content with a themed content block set to "d".
To expand the content when the page loads, add the data-collapsed="false"
attribute to the wrapper.
For a more compact version that is useful in toolbars and tight spaces, add the data-mini="true"
attribute to the element to create a mini version.
The default icons of collapsible headings can be overridden by using the data-collapsed-icon
and data-expanded-icon
attributes. In the example below, data-collapsed-icon="arrow-r"
and data-expanded-icon="arrow-d"
.
The default icon positioning of collapsible headings can be overridden by using the data-iconpos
attribute. In the below case, data-iconpos="right"
.
data-iconpos="right"
For forms, use a fieldset
and legend
for the collapsible.
By default collapsibles have an inset appearance. To make them full width without corner styling add the data-inset="false"
attribute to the element.
I'm the collapsible content. By default I'm closed, but you can click the header to open me.
This is an example of a series of individual collapsibles. The difference with a "Collapsible Set" is that multiple collapsible rows can be open at once.
To avoid "double" borders the framework removes the top border of collapsibles that are immediately preceded by another collapsible. Here we show how to negate this with custom CSS.