docs/en-US/component/collapse.md
Use Collapse to store contents.
You can expand multiple panels
:::demo
collapse/basic
:::
In accordion mode, only one panel can be expanded at once
:::demo Activate accordion mode using the accordion attribute.
collapse/accordion
:::
Besides using the title attribute, you can customize panel title with named slots, which makes adding custom content, e.g. icons, possible.
:::tip
Starting from version ^(2.9.10), the title slot provides an isActive property that indicates whether the current collapse item is active.
:::
:::demo
collapse/customization
:::
Besides using the icon attribute, you can customize icon of panel item with named slots, which makes adding custom content.
:::demo
collapse/custom-icon
:::
using the expand-icon-position attribute, you can customize icon position.
:::demo
collapse/custom-icon-position
:::
set the before-collapse property, If false is returned or a Promise is returned and then is rejected, will stop collapsing.
:::demo
collapse/prevent-collapsing
:::
| Name | Description | Type | Default |
|---|---|---|---|
| model-value / v-model | currently active panel, the type is string in accordion mode, otherwise it is array | ^[string] / ^[array] | [] |
| accordion | whether to activate accordion mode | ^[boolean] | false |
| expand-icon-position ^(2.9.10) | set expand icon position | ^[enum]'left' | 'right' | right |
| before-collapse ^(2.9.11) | before-collapse hook before the collapse state changes. If false is returned or a Promise is returned and then is rejected, will stop collapsing | ^[Function]() => Promise<boolean> | boolean | — |
| Name | Description | Type |
|---|---|---|
| change | triggers when active panels change, the parameter type is string in accordion mode, otherwise it is array | ^[Function](activeNames: array | string) => void |
| Name | Description | Subtags |
|---|---|---|
| default | customize default content | Collapse Item |
| Name | Description | Type |
|---|---|---|
| activeNames | currently active panel names | ^[object]ComputedRef<(string | number)[]> |
| setActiveNames | set active panel names | ^[Function](activeNames: (string | number)[]) => void |
| Name | Description | Type | Default |
|---|---|---|---|
| name | unique identification of the panel | ^[string] / ^[number] | — |
| title | title of the panel | ^[string] | '' |
| icon ^(2.8.3) | icon of the collapse item | ^[string] / ^[Component] | ArrowRight |
| disabled | disable the collapse item | ^[boolean] | false |
| Name | Description | Type |
|---|---|---|
| default | content of Collapse Item | — |
| title | content of Collapse Item title | ^[object]{ isActive: boolean } |
| icon ^(2.8.3) | content of Collapse Item icon | ^[object]{ isActive: boolean } |
| Name | Description | Type |
|---|---|---|
| isActive | whether the current collapse item is active | ^[object]ComputedRef<boolean | undefined> |