When to use
When there is a group of content on the same level.
When there is insufficient content space, it can be used to save space in the form of a revolving door.
Commonly used for a group of pictures/cards.
By default, any number of panels can be expanded at a time. The first panel is expanded in this example.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
In accordion mode, only one panel can be expanded at a time.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
Collapse is nested inside the Collapse.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
A borderless style of Collapse.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
Customize the background, border, margin styles and icon for each panel.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
You can hide the arrow icon by passing showArrow= to CollapsePanel component.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
More than one panel can be expanded at a time, the first panel is initialized to be active in this case.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
Expand Icon Position: Making collapse's background to transparent.
A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.
API
Collapse
| Property | Description | Type | Default |
|---|
activeKey | Key of the active panel | string[] | string
number[] | number | No default value. In accordion mode, it`s the key of the first panel |
defaultActiveKey | Key of the initial active panel | string[] | string
number[] | number | - |
bordered | Toggles rendering of the border around the collapse block | boolean | true |
accordion | If true, Collapse renders as Accordion | boolean | false |
onChange | Callback function executed when active panel is changed | function | - |
expandIcon | Allow to customize collapse icon | (panelProps) => ReactNode | - |
expandIconPosition | Set expand icon position | left | right | - |
destroyInactivePanel | Destroy Inactive Panel | boolean | false |
ghost | Make the collapse borderless and its background transparent | boolean | false |
Collapse.Panel
| Property | Description | Type | Default |
|---|
disabled | If true, panel cannot be opened or closed | boolean | false |
forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | false |
header | Title of the panel | string | ReactNode | - |
key | Unique key identifying the panel from among its siblings | string | number | - |
showArrow | If false, panel will not show arrow icon | boolean | true |
extra | The extra element in the corner | ReactNode | - |