Collapsible

The collapsible component is used to put long sections of information under a block that merchants can expand or collapse.

Examples

Use for a basic “show more” interaction when you need to display more content.

Drag to resize example

Props

children
React.ReactNode
The content to display inside the collapsible.
idRequired
string
Assign a unique ID to the collapsible. For accessibility, pass this ID as the value of the triggering component’s aria-controls prop.
openRequired
boolean
Toggle whether the collapsible is expanded or not.

Accessibility

Use the collapsible component in conjunction with a button. Place the collapsible content immediately after the button that controls it, so merchants with vision or attention issues can easily discover what content is being affected.

  • Use the required id prop of the collapsible component to give the content a unique id value
  • Use the ariaExpanded prop on the button component to add an aria-expanded attribute, which conveys the expanded or collapsed state to screen reader users
  • Use the ariaControls prop on the button component, and set its value to the id value of the collapsible component

Default collapsible component

Use for a basic “show more” interaction when you need to display more content.

Collapsible on Android

Accessibility

See Material Design and development documentation about accessibility for Android:

Default collapsible component

Use for a basic “show more” interaction when you need to display more content.

Collapsible on iOS

Accessibility

See Apple’s Human Interface Guidelines and API documentation about accessibility for iOS:

Best practices

The collapsible component should:

  • Be used for information that is lower priority or that merchants don’t need to see all the time
  • Not be used to hide error messages or other critical information that requires an immediate action

Content guidelines

There are no content elements that are specific to the collapsible component. Follow the content guidelines for cards to make sure your headings, body content, links, and buttons are written consistently and clearly.