Transform static lists into interactive, toggleable sections.

The Collapse plugin, which can be used independently of this plugin, is responsible for collapsing and expanding toggle sections.


Via data attributes

When editing an existing article, create a list (<ul> or <ol> element) and click the Source Code ( < > ) button on the editor toolbar to view the source code of the page. Add the data-element="toggles" attribute to the list and optional titles to each list item using the data-title attribute:

<ul data-element="toggles">
  <li data-title="The first toggle title">...</li>
  <li data-title="The second toggle title">...</li>
  <li data-title="The third toggle title">...</li>

Both the Toggles and Collapse plugin JavaScript code is included within the plugins.min.js file by default. If you have edited this file ensure that both are still present. Because data attributes are used, you will need to ensure that the allow unsage HTML setting is enabled within Guide.

Via JavaScript

The Toggles plugin can be instantiated against a list using JavaScript:

<ul class="js-toggles">...</ul>

<script type="text/javascript">
  ready(function() {
    each('.js-toggles', function(el) {
      new Toggles(el, {
        // Options go here



The following example uses the default template, which can replaced using the plugin’s template setting.

Alternatively you can copy-and-paste your custom toggle HTML markup onto any page, eliminating the need to use the Toggles plugin.

The duration of the transition is defined in CSS, which can be modified by applying transition duration utilities the parent element. For example, use .transition-fast to increase the speed of each collapse and expand transition.


Toggle groups can be configured to behave as accordions using the accordion setting.


Options can be passed via data attributes or JavaScript.

For data attributes, append the option name to data-.

Name Type Default Description
initial number -1 The index of the toggle to open on initialization.
accordion boolean false True if the toggle group should behave as an accordion.
template string
null The name of the template to use.
templateData object {} Additional data to provide to the template rendering function.


Class Properties
toggles.render Fires when the toggles markup has been rendered and inserted into the DOM.