GC Design System Components
Home Start to use Page templates overview Basic page Components overview Breadcrumbs Button Card Checkboxes Container Date input Date modified Details Error message Error summary Fieldset File uploader Footer Grid Header Heading Icon Input Language toggle Link Notice Pagination Radios Screenreader-only Search Select Side navigation Signature Stepper Text Textarea Theme and topic menu Top navigation CSS shortcuts overview Reset styles Responsive layout State Box sizing Container sizing Display Overflow Position Visibility Font Font family Font size Font style Font weight Line height Link colour Link size Link text decoration List style Text align Text colour Text overflow Text transform Word break Margin Padding Align content Align items Align self Flex Flex direction Flex grow Flex shrink Flex wrap Gap Grid columns Grid rows Justify content Justify items Justify self Order Place content Place items Place self Background colour Border colour Border radius Border style Border width Icon names Icon size Image Cursor Pointer events Transition Styles overview Design tokens Colour tokens Spacing tokens Typography tokens Contact us Get involved Find a demo

Details
<gcds-details>

Also called: accordion, collapse.

Details is an interactive switch for a person to expand or collapse content.

Details component preview

Details anatomy

This is an anatomy of the open details component. By default, the content is collapsed.

  1. The details title summarizes the details content. Label text is in sentence case (only the initial letter is capitalized).
  2. The caret and the details title toggle the content display. The caret indicates if the component is currently open or closed. When it's open, revealing the details text, the caret points to details content.
  3. The content displays any text and images that the reader can choose to expand or collapse.

Open details

Learn more about this topic taxonomy with three labels: details title, icon and content.  Details title pointing at Learn more about this topic. Learn more about this topic is greyed blue font underlined. Icon pointed at a dark blue triangle arrow infront of the details title. When the arrow is selected it points down to show Additional information.

Closed details

Learn more about this topic taxonomy with two labels: details title and icon. The details title pointing at Learn more about this topic. Learn more about this topic is dark font underlined. Icon pointed at a dark blue triangle arrow infront of the details title.

Design and accessibility for details

Work to reduce cognitive load – not add to it

  • Avoid concealing information with a list of details titles. This interrupts the flow of reading or scrolling for those using assisted technology.
  • Consider making the first details components open by default, to help the reader understand how they work and choose what to conceal.

Select the type of content to include in a details component

First, remove any content that's not useful or important to the main task. Then you can:

  • Hide content the reader can choose to access for a task that involves some analysis to make a choice.
  • Segment content in a list so a person can select to read the part or parts most relevant to them.
  • Include supporting content that is important but secondary to the main task.
  • Use the details component to conceal content that could cause distress. The reader can choose to skip or return to the text at the moment that's right for them.
  • For sensitive content, use the title to warn users before they access that content.

Use the summary to make content findable

  • Keep the title clear and brief. Short titles are easier to scan and can help a person using assistive technology to navigate a set of details components.
  • Write a title that states what the content's about. Avoid non-descriptive titles such as "Read more". Instead, opt for a specific and descriptive summary, like "Maximum coverage amount for your physio benefit".
  • Avoid similar or identical titles. Distinct titles help people know the difference and choose the details they want to read.
  • Avoid increasing cognitive load with content that's difficult to discover or find.

Avoid nesting details

  • Avoid placing one details component inside another, where no one would know to look for that content.
  • Similarly, break up lengthy content over more than one details component to avoid hiding multiple paragraphs in the same details content section.

Alternatives to using the details component

The details component can increase cognitive load. Some people may be confused by how they work or overwhelmed by a list of titles to select.

  • Include in the main page flow, all content essential to accomplishing a task.
  • Reduce overall text by removing redundant information or anything not essential to the task.
  • Simplify the content with plain, conversational language.
  • Use subheadings to break up content.
  • Split the content into smaller sections and group common elements together.

Help us improve

Have questions or a request? Give feedback on our contact form.

Something's wrong? Raise it through GitHub with an account. You'll have access to the team's direct responses, progress made on your issue, and issues raised by others.

Give feedback Report an issue on GitHub
2025-01-22