Flutter docs
Default skin

Collapse

A content area which can be collapsed and expanded.

When to use

  • Can be used to group or hide complex regions to keep the page clean.
  • Accordion is a special kind of Collapse, which allows only one panel to be expanded at a time.

Examples

Collapse

By default, any number of panels can be expanded at a time. The first panel is expanded in this example.

Size

Ceebee UI supports a default collapse size as well as a large and small size. If a large or small collapse is desired, set the size property to either large or small respectively. Omit the size property for a collapse with the default medium size.

Accordion

In accordion mode, only one panel can be expanded at a time.

Nested panel

Collapse is nested inside the Collapse.

Borderless

A borderless style of Collapse.

Custom Panel

Customize the background, border, margin styles and icon for each panel.

Panel with icon

Add an icon to the panel title. A bare <svg> from a third-party icon library (e.g. lucide, react-icons) stays vertically centred with the title text.

No arrow

You can hide the arrow icon by passing showArrow={false} to CollapsePanel component.

Extra node

Render extra element in the top-right corner of each panel.

Ghost Collapse

Making collapse's background to transparent.

Collapsible

Specify the trigger area of collapsible by collapsible.

Custom semantic dom styling

You can customize the semantic dom style of Collapse by passing objects/functions through classNames and styles.

API

Collapse and Collapse.Panel are exported from @ceebee/ui/client.

Collapse

PropertyDescriptionTypeDefaultVersion
accordionIf true, Collapse renders as Accordionbooleanfalse—
activeKeyKey of the active panelstring\[] | string <br/> number\[] | numberNo default value. In accordion mode, it's the key of the first panel—
borderedToggles rendering of the border around the collapse blockbooleantrue—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
collapsibleSpecify how to trigger Collapse. Either by clicking icon or by clicking any area in header or disable collapse functionality itselfheader | icon | disabled-4.9.0
defaultActiveKeyKey of the initial active panelstring\[] | string <br/> number\[] | number-—
destroyInactivePanelDestroy Inactive Panelbooleanfalse—
destroyOnHiddenDestroy Inactive Panelbooleanfalse5.25.0
expandIconCustomize the collapse expand icon(panelProps) => ReactNode-—
expandIconPlacementSet expand icon placementstart | endstart-
expandIconPositionSet expand icon position, Please use expandIconPlacement insteadstart | end-4.21.0
ghostMake the collapse borderless and its background transparentbooleanfalse4.4.0
sizeSet the size of collapselarge | medium | smallmedium5.2.0
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
onChangeCallback function executed when active panel is changedfunction-—
itemscollapse items contentItemType-5.6.0

ItemType

PropertyDescriptionTypeDefaultVersion
classNamesSemantic structure classNameRecord<header | body, string>-5.21.0
collapsibleSpecify whether the panel be collapsible or the trigger area of collapsibleheader | icon | disabled-—
childrenBody area contentReactNode-—
extraThe extra element in the cornerReactNode-—
forceRenderForced render of content on panel, instead of lazy rendering after clicking on headerbooleanfalse—
keyUnique key identifying the panel from among its siblingsstring | number-—
labelTitle of the panelReactNode--
showArrowIf false, panel will not show arrow icon. If false, collapsible can't be set as iconbooleantrue—
stylesSemantic DOM styleRecord<header | body, CSSProperties>-5.21.0

Collapse.Panel

PropertyDescriptionTypeDefaultVersion
collapsibleSpecify whether the panel be collapsible or the trigger area of collapsibleheader | icon | disabled-4.9.0 (icon: 4.24.0)
extraThe extra element in the cornerReactNode-—
forceRenderForced render of content on panel, instead of lazy rendering after clicking on headerbooleanfalse—
headerTitle of the panelReactNode-—
keyUnique key identifying the panel from among its siblingsstring | number-—
showArrowIf false, panel will not show arrow icon. If false, collapsible can't be set as iconbooleantrue—