Collapse
Toggle the visibility of content across your project with a few classes and our JavaScript plugins.
Component Properties
title
: (string) The text displayed on the collapse trigger button. It is the label for the collapsible content.
button_html_tag
(optional): (string) Specifies the HTML tag to be used for the collapse trigger. It can be either button
or a
(anchor). Defaults to button.
id
(optional): (integer) A unique identifier for the collapse component. This is important for accessibility and JavaScript functionality.
direction
(optional): (string) The direction in which the content will collapse. Can be vertical
or horizontal
. Defaults to vertical
.
collapsed
(optional): (boolean) Indicates whether the collapsible content is initially collapsed. Defaults to true, meaning the content starts in a collapsed state.
content
: (string/block) The content that will be shown when the collapse component is expanded. This can be a simple text string, HTML, or other Drupal blocks.
Usage
Example #1: Simple text based collapse.
Example #2: More common with block overrides.
Last updated