Collapse

Display large amounts of text in collapsible sections. Commonly referred to as an accordion.

General

Show title only by default.

Expanded

Specify what to display first.

Subtitle

Add text or components as subtitle.

Shadow

Highlight importance at a higher level.

Controlled and disabled

Pass visible and onVisibleChange to control a section. A section with disabled cannot be toggled.

APIs

Collapse.Props

AttributeDescriptionTypeAccepted valuesDefault
title(required)collapse titlestring--
subtitledescriptionstring--
initialVisibleinitial expandedboolean-false
visibleexpanded, to control itboolean--
onVisibleChangecalled with the next state when the header is clicked(visible: boolean) => void--
disabledthe section cannot be toggledboolean-false
shadowshow shadow cardboolean-false
...native propsHTMLAttributes'id', 'name', 'className', ...-

Collapse.Group.Props

AttributeDescriptionTypeAccepted valuesDefault
accordionaccordion modeboolean-true
...native propsHTMLAttributes'id', 'name', 'className', ...-

Accessibility

The title is a heading with a real button inside, so a screen reader announces it as a heading and as a button that is expanded or collapsed, and aria-controls points at the content. Enter and Space toggle a section. In a Collapse.Group, the Up and Down arrows move focus between the titles, wrapping at the ends, and Home and End go to the first and the last. Disabled sections are skipped.

Edit this page on GitHub