## Checkbox ### Install ``` javascript import { Checkbox, CheckboxGroup } from 'vant'; Vue.use(Checkbox).use(CheckboxGroup); ``` ### Usage #### Basic Usage ```html Checkbox ``` ```javascript export default { data() { return { checked: true }; } }; ``` #### Disabled ```html Checkbox ``` #### Disable Label click event ```html Checkbox ``` #### Checkbox Group When Checkboxes are inside a CheckboxGroup, the checked checkboxes's name is an array and bound with CheckboxGroup by v-model. ```html Checkbox {{ item }} ``` ```javascript export default { data() { return { list: ['a', 'b', 'c'], result: ['a', 'b'] }; } }; ``` #### Maximum amount of checked options ```html Checkbox {{ item }} ``` #### Inside a Cell ```html ``` ### Checkbox API | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| | v-model | Check status | `Boolean` | `false` | - | | name | Checkbox name | `any` | - | - | | disabled | Diable checkbox | `Boolean` | `false` | - | | label-disabled | Whether to disable label click | `Boolean` | `false` | - | | shape | Checkbox shape | `String` | `round` | `square` | ### CheckboxGroup API | Attribute | Description | Type | Default | Accepted Values | |-----------|-----------|-----------|-------------|-------------| | v-model | Names of all checked checkboxes | `Array` | - | - | | disabled | Disable all checkboxes | `Boolean` | `false` | - | | max | Maximum amount of checked options | `Number` | `0`(Unlimited) | - | ### Checkbox Event | Event | Description | Parameters | |-----------|-----------|-----------| | change | Triggered when value changed | current value | ### CheckboxGroup Event | Event | Description | Parameters | |-----------|-----------|-----------| | change | Triggered when value changed | current value |