JGuang

Collapse

Collapse · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

Collapse

The content area that can be collapsed/expanded.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: Collapse is used to group and hide complex content areas. You can decide which panels to be expanded.
  • Accordion: Render as Accordion.
  • Nested Panels: Nested panels.
  • Borderless Panel: Pass in bordered=false to use simple style without borders.
  • Custom Panel Style: Use style to customize style of panel.
  • Extra Node: The extra node on the far right can be set by extra.
  • Position of IconExpand: The position of the expandIcon can be set through expandIconPosition.
  • Lazyload: Whether to render children until the first expansion of Collapse.Item.
  • Destroy On Hide: The collapsed panel can be destroyed through the destroyOnHide property.
  • Specify Folding Trigger Area: Through the triggerRegion, set the region that can trigger collapsing.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Collapse

PropertyDescriptionTypeDefaultValueVersion
accordionWhether to render as Accordionboolean--
borderedWhether to render borderbooleantrue-
destroyOnHideIf true, panels will be unmounted on collapsingboolean--
lazyloadIf true, invisible panels will not be rendered on mountbooleantrue-
expandIconPositionPosition of collapse icon'left' | 'right'left-
triggerRegionThe area that can trigger the collapse operation'header' | 'icon'-2.41.0
expandIconCustom collapse iconReactNode--
activeKeyKey of the active panelstring | string[]--
classNameAdditional css classstring | string[]--
defaultActiveKeyKey of the default active panelstring | string[]--
styleAdditional styleCSSProperties--
onChangeCallback when the active panel changes(key: string, keys: string[], e) => void--

Collapse.Item

PropertyDescriptionTypeDefaultValueVersion
destroyOnHideIf true, item will be unmounted on collapsing. (Higher priority than Collapse.destroyOnHide)boolean--
disabledIf true, the panel is not collapsibleboolean--
showExpandIconWhether to show expand iconbooleantrue-
nameUnique identifier key of the current panel itemstring (Required)--
expandIconCustom expand iconReactNode--
extraThe extra element in the cornerReactNode--
headerHeader contentReactNode--
classNameAdditional css classstring | string[]--
contentStyleAdditional styles of the content area.CSSProperties-2.15.0
styleAdditional styleCSSProperties--