Skip to main content
On this page

Show and hide non-critical, contextual content in place

When to use​

  • To make a page easier to scan when it contains information that only some users will need
  • For supporting explanations that users are unlikely to need on repeat visits

When not to use​

  • When the information is critical, or a majority of users will need it - forcing most users to make an extra click slows down task completion, and some users might miss it altogether. Show the information instead.
  • In a group - for instance, to show a list of frequently asked questions. Use Accordion instead, unless the content is inside a constrained layout such as a Card or narrow sidebar, where Accordion would be disproportionate.
  • To switch between distinct sections of content - Disclosure is for revealing detail in place, not for navigation between views. Use Tabs instead.
  • For brief supplementary information about a specific element - Disclosure is for longer content that benefits from being read in context. Use Tooltip instead.
  • For substantial content that warrants its own focus - it may be more appropriate to use Modal instead.

Anatomy​

  1. Caret
  2. Title
  3. Content indent
  4. Disclosure content

Keyboard support​

Focus order​

  1. Caret and title

Keyboard functions​

  • Tab - Moves keyboard focus to Disclosure
  • Space or Enter - Toggles the expanded/collapsed state of the disclosure

Basic usage​

Disclosure uses the native HTML details and summary elements. This means open and close behaviour is handled by the browser without JavaScript.

Loading...
Edit live code
<Disclosure title="What is a carbon footprint?">
  <P>A person's carbon footprint is made up of all the carbon that’s released through actions they take and choices they make, in their day-to-day lives.</P>
</Disclosure>

Variants and features​

Expanded by default​

Disclosure is an uncontrolled component and manages its own state. The default state can be set with the open prop.

Loading...
Edit live code
<Disclosure title="What is a carbon footprint?" open>
  <P>A person's carbon footprint is made up of all the carbon that's released through actions they take and choices they make, in their day-to-day lives.</P>
</Disclosure>