mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-01 03:28:42 +08:00
2.1 KiB
2.1 KiB
category | type | title | cover |
---|---|---|---|
Components | Data Entry | Checkbox | https://gw.alipayobjects.com/zos/alicdn/8nbVbHEm_/CheckBox.svg |
Checkbox component.
When To Use
- Used for selecting multiple values from several options.
- If you use only one checkbox, it is the same as using Switch to toggle between two states. The difference is that Switch will trigger the state change directly, but Checkbox just marks the state as changed and this needs to be submitted.
API
Props
Checkbox
Property | Description | Type | Default | Version |
---|---|---|---|---|
autofocus | get focus when component mounted | boolean | false | |
checked(v-model) | Specifies whether the checkbox is selected. | boolean | false | |
disabled | Disable checkbox | boolean | false | |
indeterminate | indeterminate checked state of checkbox | boolean | false | |
value | value of checkbox in CheckboxGroup | boolean | string | number | - |
events
Events Name | Description | Arguments | Version |
---|---|---|---|
change | The callback function that is triggered when the state changes. | Function(e:Event) |
Checkbox Group
Property | Description | Type | Default | Version |
---|---|---|---|---|
disabled | Disable all checkboxes | boolean | false | |
name | The name property of all input[type="checkbox"] children |
string | - | 1.5.0 |
options | Specifies options, you can customize label with slot = "label" slot-scope="option" |
string[] | Array<{ label: string value: string disabled?: boolean, indeterminate?: boolean, onChange?: function }> | [] | |
value(v-model) | Used for setting the currently selected value. | string[] | [] |
events
Events Name | Description | Arguments | Version |
---|---|---|---|
change | The callback function that is triggered when the state changes. | Function(checkedValue) |
Methods
Checkbox
Name | Description | Version |
---|---|---|
blur() | remove focus | |
focus() | get focus |