Skip to content

Collapse ​

Use Collapse to store contents.

Basic usage ​

You can expand multiple panels

Accordion ​

In accordion mode, only one panel can be expanded at once

Activate accordion mode using the accordion attribute.

Custom title ​

Besides using the title attribute, you can customize panel title with named slots, which makes adding custom content, e.g. icons, possible.

Starting from version ^(2.9.10), the title slot provides an isActive property that indicates whether the current collapse item is active.

Custom icon ​

Besides using the icon attribute, you can customize icon of panel item with named slots, which makes adding custom content.

Custom icon position ​

using the expand-icon-position attribute, you can customize icon position.

Prevent collapsing ​

set the before-collapse property, If false is returned or a Promise is returned and then is rejected, will stop collapsing.

Collapse API ​

Collapse Attributes ​

NameDescriptionTypeDefault
valuecurrently active panel, the type is string in accordion mode, otherwise it is array'string' | string[][]
accordionwhether to activate accordion modebooleanfalse
expand-icon-positionset expand icon position'left' | 'right' right
before-collapsebefore-collapse hook before the collapse state changes. If false is returned or a Promise is returned and then is rejected, will stop collapsing() => Promise<boolean> | boolean—

Collapse Events ​

NameDescriptionType
changetriggers when active panels change, the parameter type is string in accordion mode, otherwise it is array(e: CustomEvent) => void

Collapse Slots ​

NameDescriptionSubtags
defaultcustomize default contentCollapse Item

Collapse Item API ​

Collapse Item Attributes ​

NameDescriptionTypeDefault
nameunique identification of the panelstring | number—
titletitle of the panelstring''
iconicon of the collapse itemstring'arrow-right'
disableddisable the collapse itembooleanfalse

Collapse Item Slot ​

NameDescription
defaultcontent of Collapse Item
titlecontent of Collapse Item title
iconcontent of Collapse Item icon

Released under the MIT License.