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

Build a details component

Use the details component to give a person a summary of content you've hidden that they can choose to reveal.

Use details to let a person toggle the display of additional content related to the details title.

Coding and accessibility for details

Present the details component to support understanding

The details component can add to a person's cognitive load when it:

  1. Interrupts the flow of reading or scrolling.
  2. The content they need is difficult to find and search.
  3. They are unfamiliar with the expand and collapse function.

To help a reader's experience accessing details content:

  • Use the open attribute to define if the details content is open by default or not.
  • Make details titles clearly state 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".
  • Make titles distinct so people know the difference. Identical or similar titles can be confused.
  • Avoid placing one details component inside another, where no one would know to look for that content.
  • Make details content searchable.

Get your code

Generate an instance of the component you need by selecting its code properties.

  1. Explore by choosing different code values to generate the instance you want.

  2. Get the code and pull it into your environment.

  3. Add any copy you need to the component (like text for a label).

Note: The code builder uses English for all code elements, which follows standard practice.

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
2024-02-21