Accordions are ideal when you have lots of content to display and either of these conditions apply:
only a compact space is available—too little to display everything at once
users will likely drill into only one portion of the content, and you wish to spare them the visual complexity of showing everything at once.
When to consider an alternative
If visitors need to see most or all of the information on a page or if there’s not enough content to justify condensing, use well-formatted text instead. Consider using Tabs if you have five or less content panels, and if the headings are a short tab-length. If you have just one element that you want to toggle into view, consider the Show More component.
The Show More component is also a better alternative if you’re organizing an entire page into an accordion-style presentation (like a Frequently Asked Questions page). The larger type size and header organization makes the expandable section better suited to page-level hierarchy than the accordion.
Class Name
Description
orc-c-accordion
Required
Apply to the wrapper element for the overall component. The recommended element for this class is <ul>. This class handles the outer border and margins for the accordion.
orc-c-accordion__item
Required
Apply to each immediate child <li> of the orc-c-accordion list. Each of these elements holds the heading and content for a single accordion item.
orc-js-accordion-item
ModifierJSRequired
Add to each orc-c-accordion__item. This class helps Orchid’s JavaScript library to open/close the orc-c-accordion__item by adding/removing the is-closed class.
orc-c-accordion__header
Required
Apply to the wrapper for each item’s header element. The only child of this element is the orc-c-accordion__title element. The class handles the border, type size, and cursor type for each header. The recommended element for this class is <div>.
orc-c-accordion__title
Required
Apply to the <a> element that contains the heading title for each item. The class handles the title’s text/icon layout, as well as the padding, color, and text treatment. This <a> contains the orc-c-accordion__icon and orc-c-accordion__title-text elements.
orc-js-accordion-trigger
ModifierJSRequired
Add to the orc-c-accordion__title element to help Orchid’s JavaScript library to toggle the display of the accordion item on click. To do this, Orchid adds/removes the is-closed class to the orc-js-accordion-item element.
orc-c-accordion__icon
Required
Add to the orc-c-icon element that displays the icon (#icon-caret-down) to indicate that the accordion can be opened/closed. This element should be the first child of orc-c-accordion__title, before orc-c-accordion__title-text.
orc-c-accordion__title-text
Required
Apply to the <span> element that contains the title of each accordion item.
orc-c-accordion__body
Required
Apply to the container for each item’s body content. The recommended element for this class is <div>. The element can contain any arbitrary HTML.