# Checkbox A group of options for multiple selections. ## Basic Usage The `v-model` attribute is used to set the currently selected value. ```html Option ``` ```typescript import { reactive, toRefs } from 'vue' export default { setup() { const state = reactive({ value: true }) return { ...toRefs(state) } } } ``` ## Disabled State Set the `disabled` attribute to disable the checkbox. ```html Disabled Option ``` ## Custom Shape Set the `shape` attribute to customize the shape of the checkbox, which can be set to 'button' or 'square', default is 'circle'. ```html Square Checkbox Button Checkbox ``` ## Custom Color Set the `checked-color` attribute to customize the color when checked. ```html Custom Color ``` ## Checkbox Size Set the `size` attribute to customize the size of the checkbox, which can be set to 'large', default is ''. ```html Large Checkbox ``` ## True Value and False Value Set the `true-value` and `false-value` attributes to customize the value when checked and unchecked. ```html Custom Value ``` ## Checkbox Group The `value` of the checkbox group is an array, which contains the values of all selected checkboxes. The `value` of each checkbox is set through the `value` attribute. ```html Option 1 Option 2 Option 3 Option 4 ``` ```typescript import { reactive, toRefs } from 'vue' export default { setup() { const state = reactive({ value: ['1', '3'] }) return { ...toRefs(state) } } } ``` ## Horizontal Display Set the `inline` attribute to display checkboxes horizontally. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Disabled Checkbox Group Set the `disabled` attribute on the checkbox group to disable all checkboxes in the group. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Custom Shape for Checkbox Group Set the `shape` attribute on the checkbox group to customize the shape of all checkboxes in the group. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Custom Color for Checkbox Group Set the `checked-color` attribute on the checkbox group to customize the color of all checkboxes in the group when checked. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Custom Size for Checkbox Group Set the `size` attribute on the checkbox group to customize the size of all checkboxes in the group. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Maximum Number of Selections Set the `max` attribute on the checkbox group to limit the maximum number of selections. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Cell Style Set the `cell` attribute on the checkbox group to display checkboxes in cell style. ```html Option 1 Option 2 Option 3 Option 4 ``` ## Checkbox Attributes | Attribute | Description | Type | Default | Version | |---------|---------|---------|---------|------| | v-model | Selected value | boolean / string / number | - | - | | value | Checkbox value | string / number / boolean | - | - | | shape | Checkbox shape, can be 'circle', 'square', 'button' | string | circle | - | | checked-color | Color when checked | string | #4D80F0 | - | | disabled | Whether to disable the checkbox | boolean | false | - | | true-value | Value when checked | string / number / boolean | true | - | | false-value | Value when unchecked | string / number / boolean | false | - | | size | Checkbox size, can be 'large' | string | - | - | ## Checkbox Events | Event Name | Description | Parameters | Version | |---------|---------|---------|------| | change | Triggered when the binding value changes | value: selected value | - | ## Checkbox Slots | Name | Description | Version | |---------|---------|------| | default | Custom content | - | ## Checkbox External Style Classes | Class Name | Description | Version | |---------|---------|------| | custom-class | Root node custom class | - | ## CheckboxGroup Attributes | Attribute | Description | Type | Default | Version | |---------|---------|---------|---------|------| | v-model | Selected value | array | - | - | | shape | Checkbox shape, can be 'circle', 'square', 'button' | string | circle | - | | checked-color | Color when checked | string | #4D80F0 | - | | disabled | Whether to disable all checkboxes | boolean | false | - | | max | Maximum number of selections | number | - | - | | inline | Whether to display checkboxes horizontally | boolean | false | - | | cell | Whether to display checkboxes in cell style | boolean | false | - | | size | Checkbox size, can be 'large' | string | - | - | ## CheckboxGroup Events | Event Name | Description | Parameters | Version | |---------|---------|---------|------| | change | Triggered when the binding value changes | value: selected value | - | ## CheckboxGroup Slots | Name | Description | Version | |---------|---------|------| | default | Custom content | - | ## CheckboxGroup External Style Classes | Class Name | Description | Version | |---------|---------|------| | custom-class | Root node custom class | - |