Components · Layout and content

Collapsible

A collapsible is a row that opens and closes to show more content, used for FAQ lists and filters. The header can carry a descriptive text, icons, a toggle switch and a number badge. The content animates open.

Every example on this page is the real component, not a picture. Figma: Base / Collapsible, Collapsible & Collapsible open, Support + Visa mer, boxed setup and, for the Storyblok context, Collapsible context examples.

Playground

One row. Click the header to open and close it. Choose the size, the theme, the state and the parts of the header and the row and its code update.

Breakpoint
Size
Boxed
Header background
Top divider
Bottom divider
Theme
State
Row
Helper text
Leading icon
Trailing icon
Toggle switch
Number badge
Chevron

The animation is set in Motion.

Markup for this selection

HTML

Overview

A collapsible is a row that opens and closes to show more content. The header names the section and can carry a descriptive text, helper text, icons, a toggle switch and a number badge. Rows stack into a list, such as an FAQ or a filter, and share one line between them.

Collapsible has two sizes (Large and Small), a boxed variant (both sizes), a light and a dark theme, and the states enabled, hover and disabled. The content is free: text, a list of checkboxes, supporting text with an action. Each row opens on its own.

In Storyblok this component is the Collapsible block. Its Open switch is the open state of a row (collapsible-wrap--open). The Storyblok widget has its own Storyblok tab in Supernova.

This documentation has three pages. Examples & Guidelines (this page) shows when and how to use a collapsible. Specifications holds the values: tokens, sizes, measurements, states and requirements. Code shows how to add one to a page.


Usage

When to use

Use a collapsible when the user skims a list and opens one part at a time. Use it for:

  • To organize related content in a limited space, for example an FAQ that gives a clean overview of the most common questions
  • To hide complex or less important details, so the user can focus on the key points first
  • Filter groups, where each group holds a list of checkboxes
  • Long, optional content, such as delivery or return details

When not to use

Do not use it to compare

When the user must see all the content at once, to compare or to understand the context, hiding part of it limits the understanding. Show the content side by side instead.

Do not use it where people open and close a lot

Frequent opening and closing frustrates and overwhelms. Open the row that helps the user most from the start (collapsible-wrap--open; the Open switch in Storyblok), for example the first question in a grouped FAQ.

The row that helps most is open from the start; the others stay closed.

Do not hide what people must read

A closed row can be missed. Keep information that people need to continue in plain text.

Do hide extra detail that only some people need.
Do not hide terms that people must read before they continue.

Keep the title short

Write the title as the question or the topic, so the user can scan the closed list. Put the current choice in the descriptive text, not a sentence in the title.

Do write a short title, and the choice as descriptive text.
Do not write a whole sentence as the title.

Do not nest collapsibles

A collapsible inside a collapsible hides the content behind two clicks and harms usability. Use one level, or split the content into separate sections.

For two views of the same content

A collapsible shows more of one thing. To switch between two views of the same content, use Pill segment control. To move between pages, use Tabs or navigation.

Best practices

  • Keep item titles short and descriptive.
  • Use collapsibles to reduce visual clutter and help users focus on the key content.
  • Avoid many collapsibles in one view: they create a cluttered experience instead.
  • Give every collapsible a clear purpose that improves usability. Never use one only for decoration, or when all the content needs to be visible at once.
  • Keep the content from getting too wide. Review the line length (60–90 characters is ideal) under Typography.

Quick reference

The user…Use
skims a list of questions or sections and opens one at a timeCollapsible
must see all the textPlain text with headings
switches between views of the same contenteco-pill-segment-control
moves between pagesTabs or navigation

Do

  • Use for FAQ, filters and long, optional content.
  • Keep titles short. Put the current choice in the descriptive text.
  • Use a button for the header, with aria-expanded.
  • Hide the last row’s line when the list ends the section.

Don’t

  • Hide content people must read to continue.
  • Nest collapsibles.
  • Use many collapsibles in one view, or one only for decoration.
  • Put a switch and a chevron in the same header: the control sits inside a control.
  • Animate with CSS height: it cannot reach auto.

Anatomy

Header

  1. Leading icon. Optional. A Material Symbol before the title.
  2. Title. The name of the section. Bold.
  3. Descriptive text. Optional. The current choice or a short note, in regular weight on the same line.
  4. Helper text. Optional. A line of body-sm text under the title.
  5. Trailing icon. Optional. A Material Symbol after the text.
  6. Toggle switch. Optional. An on/off setting that belongs to the section.
  7. Number badge. Optional. For example the number of selected filters.
  8. Chevron. An expand_more icon that rotates 180° when the row is open.

Open row

  1. Header. The clickable row. At least 72px high (Large) or 56px (Small).
  2. Content. The answer or the options. It animates open with max-height; an open row has 32px of space below it.
  3. Line. A 1px line under the row, shared with the next row in the list.

Variants

Rows stack into a list and share one line between them. Each row opens on its own.

Header content

Title only, with a descriptive text, with a leading icon, with helper text and with a number badge. Combine the parts as the row needs.

With a toggle switch

A row can hold a setting that turns on and off, such as “Sale items”. Leave out the chevron: a switch inside a header that also opens is a control inside a control.

Size

Large (72px) is the default. Small (56px) has smaller type and 20px icons, for dense layouts such as filters.

Boxed

A frame around the row, in both sizes. When it is open, a line separates the header from the content, which sits on white. The header is grey only when Header background is on (see Background below).

Dividers

The line under the row is on by default, so rows in a list share it. The line above is off. Switch each on or off on its own: collapsible-wrap--divider-top adds the top line, collapsible-wrap--no-divider-bottom removes the bottom line. A boxed row has its frame instead.

Default: bottom only
Top and bottom
Top only
None

Background

A row can have a background, surface-raised-secondary, on the header only. It is an add-on in the header part. The content stays on white. Use it to set one row apart in a list, or to give a boxed row a grey header, closed or open. Without it no row is grey, open or closed. The header gets 16px of side padding so the text keeps off the edge, and the content gets the same so it lines up. The content text starts 24px (Large) or 16px (Small) below the grey header.

Theme

On a black surface use the dark theme. The line, the text and the number badge change; the layout does not. A filled row in the dark theme has a surface-90 header, and the body and the content stay on the black surface. On hover the title and the descriptive text dim; the helper text stays white.

Disabled

A disabled row cannot be opened. Text, icons and the badge turn to the disabled colors.

Content

The content is free. These are the compositions in Figma.

Text

Checkbox list

Each option has a number of results. A supporting text and a “Show more” action can follow the list.

Filter list

A filter panel is a list of Large rows. The first row has a top divider. A row can show the current choice as descriptive text, hold a toggle switch with no chevron, or carry a trailing icon and a number of selected values. An open row can start with a search field, followed by the checkbox list.

Supporting text and action

Supporting text with a “Show more” action and, when the section has a main action, a Secondary button (XSmall).

Boxed with expanded content

An intro text and a list of items on grey surfaces, each with a bold title and extra information. The header uses the grey Header background, as in Figma.


Sizes

A collapsible has two sizes. Large is 72px high and Small is 56px high. Boxed exists in both sizes. The values are under Sizes in Specifications.


Layout & Appearance

Alignment

The icon and the text sit on the left, the switch, the badge and the chevron on the right with 16px between them. The content lines up with the left edge of the row.

Placement

A list sits inside a section. When the list is the last block in its section, the last row’s line is hidden, so no line hangs right above the section’s own padding. When something follows the list, such as a call to action, the line stays. A boxed row always keeps its frame.

The list ends the section: the last line is hidden.
A call to action follows the list.
Something follows the list: the last line stays.

Width

A collapsible is as wide as its container. Long titles wrap onto a second line and the header grows.

Surface

A collapsible can sit on a white or on a grey section (section--secondary). The grey Header background has the same color as the grey section, so do not combine them.

Dividers

Use dividers only where they add clarity. In a list the line under each row separates the rows. Switch the lines on and off one by one (see Variants) and follow these rules. A list in a panel or drawer, such as a filter list, starts with a top divider on the first row.

In a list

Put lines between the rows only: none above the first row and none under the last. The last row in a section loses its bottom line by itself.

Do use dividers only between the rows.
Do not add a line above the first row or under the last row of a group.

A single collapsible

A section with only one collapsible has no neighbours to share a line with, so it gets both the top and the bottom line (--divider-top and --divider-bottom). Not on a colored section: the surface already separates it.

Do use the top and the bottom divider in a section with only one collapsible.
Do not add dividers to a single collapsible on a colored surface that differs from the areas around it.

With a headline

When the section has an optional headline above the collapsible, skip the top divider: the headline already opens the group. On a colored section the row then has no dividers at all.

Do skip the top divider when the optional headline is used: the row has no dividers on the colored section.
Do not put a top divider between the headline and the collapsible.

Appearance

The title and the icons are black and turn grey on hover. The content is black. Helper text is dark grey and turns lighter on hover; counts and notes are grey. Token names and values are under Design Tokens in Specifications.


Behavior

Click

A click on the header opens or closes the row. The content grows from zero to its full height and the chevron turns 180°. An open row gets 32px of extra space below the content. A click on the toggle switch changes the switch and does not open the row.

Hover

The title, the descriptive text, the icons and the chevron turn to the action hover color. The whole header reacts, not only the text.

Several rows

The rows are independent. Opening one does not close another.

Disabled

A disabled row does not react to hover or click and cannot be reached with Tab.


Accessibility

All requirements are listed under Accessibility Requirements in Specifications.

Keyboard support

A button header is reached with Tab and opens with Enter or Space. Closed content cannot be reached: it is hidden until the row is open.

Screen reader support

The header announces its state through aria-expanded and points to its content with aria-controls. A header with a toggle switch is not a button: the switch is announced on its own, and the row does not open.



References