Expandable sections

Like tabs, expandable sections are a great way to display large amounts of information in a way that doesn’t overwhelm users. Unlike tabs, you aren’t limited to a certain number of headings, and the headings can be any length.

Expandable sections can be used on their own or in groups of multiple sections. Unlike tabs, the content in each expandable section doesn’t need to be directly related to those around it.

Expandable sections can include any kind of content, such as text, lists, images, or videos. They are often used for things like instructions, “more information”, bios, and frequently asked questions.

Development info

  • Stylesheet location: /source-v6/styles/components/_open-sesame.scss
  • div class="open-sesame"
  • Headings must all be the same level (h4, etc.)
    • The headings turn into the visible expandable links
    • The expandable content can include headings, but they must be at a level below the expandable headings.
  • Javascript adds all the extra functionality and styles to make the sections expand and be accessible. You only need to include the headings and corresponding content.
  • The expandable content can include any HTML elements.
  • In WordPress, use the pcc-collapse shortcode.
  • <div class="open-sesame>
      <h4>Heading 1</h4>
      <p>Expandable section 1 content</p>
      <h4>Heading 2</h4>
      <p>Expandable section 2 content</p>
      <h4>Heading 3</h4>
      <p>Expandable section 3 content</p>
    </div>

Styling

Only the top-level headings are visible by default. These headings have a plus icon to the left of the text indicating that it’s expandable. When clicked and expanded, the corresponding content slides down into view, and the icon next to the heading turns into a minus icon.

It’s fine if the headings wrap to a second line – they look like regular link text – but try to keep them as short as possible without losing meaning.

Responsive behavior

No change.

Examples of expandable sections:
Dogs will give you unconditional love forever. Cats…

…will make you pay for every mistake you’ve ever made since the day you were born.

What is it called when a cat wins a dog show?

A cat-has-trophy!

What is a group of cats called?

A clowder!