# Collapse ### Install ``` javascript import { Collapse, CollapseItem } from 'vant'; Vue.use(Collapse).use(CollapseItem); ``` ## Usage ### Basic Usage Use `v-model` to control the name of active panels ```html Content Content Content ``` ``` javascript export default { data() { return { activeNames: ['1'] }; } }; ``` ### Accordion In accordion mode, only one panel can be expanded at the same time. ```html Content Content Content ``` ``` javascript export default { data() { return { activeName: '1' }; } }; ``` ### Custom title ```html
Title1
Content
Content
``` ## API ### Collapse Props | Attribute | Description | Type | Default | |------|------|------|------| | v-model | names of current active panels | `Array | String | Number` | - | | accordion | Whether to be accordion mode | `Boolean` | `false` | | border | Whether to show outer border | `Boolean` | `true` | ### Collapse Events | Event | Description | Arguments | |------|------|------| | change | Triggered when switch panel | activeNames: `string | array` | ### CollapseItem Props | Attribute | Description | Type | Default | |------|------|------|------| | name | Name | `String | Number` | `index` | | icon | Left Icon | `String` | - | | size | Title sizeļ¼Œcan be set to `large` | `String` | - | | title | Title | `String | Number` | - | | value | Right text | `String | Number` | - | | label | Description below the title | `String` | - | | border | Whether to show inner border | `Boolean` | `true` | | disabled | Whether to disabled collapse | `Boolean` | `false` | | is-link | Whether to show link icon | `Boolean` | `true` | | title-class | Title className | `String` | - | | value-class | Value className | `String` | - | | label-class | Label className | `String` | - | ### CollapseItem Slots | Name | Description | |------|------| | default | Content | | value | Custom value | | icon | Custom icon | | title | Custom title | | right-icon | Custom right icon |