Checkbox
Rules
Basic Example
js
const rule = {
type:"checkbox",
title:"Label",
field:"label",
value:["1","2","3"],
options:[
{value:"1",label:"Easy to Use",disabled:true},
{value:"2",label:"Convenient",disabled:false},
{value:"3",label:"Practical",disabled:false},
{value:"4",label:"Effective",disabled:false},
]
}Props Configuration Examples
Vertical Arrangement
js
const rule = {
type:"checkbox",
title:"Product Tags",
field:"tags",
value:["1"],
options:[
{value:"1",label:"Hot Sale"},
{value:"2",label:"New Product"},
{value:"3",label:"Recommended"},
],
props: {
direction: "vertical",
}
}Disabled State
js
const rule = {
type:"checkbox",
title:"Permission Settings",
field:"permissions",
value:["1"],
options:[
{value:"1",label:"View",disabled:false},
{value:"2",label:"Edit",disabled:true},
{value:"3",label:"Delete",disabled:true},
],
props: {
disabled: false,
}
}Events Examples
Handle Selection Changes
js
const rule = {
type:"checkbox",
title:"Product Tags",
field:"tags",
value:["1"],
options:[
{value:"1",label:"Hot Sale"},
{value:"2",label:"New Product"},
{value:"3",label:"Recommended"},
],
on: {
change: (value) => {
console.log('Selection value changed:', value);
},
},
}Linkage Update After Selection
js
const rule = [
{
type:"checkbox",
title:"Product Tags",
field:"tags",
value:[],
options:[
{value:"1",label:"Hot Sale"},
{value:"2",label:"New Product"},
{value:"3",label:"Recommended"},
],
inject: true,
on: {
change: ($inject, value) => {
// Set status based on selected tag count
if (value.length >= 2) {
$inject.api.setValue('status', 'active');
} else {
$inject.api.setValue('status', 'inactive');
}
},
},
},
{
type:"input",
title:"Product Status",
field:"status",
props: {
disabled: true,
},
},
]Complete configuration items: arco-design_Checkbox
value: Array
Options
| Field Name | Description | Field Type | Required | Default |
|---|---|---|---|---|
| value | Parameter value | String,Number | true | - |
| label | Field alias | String | true | - |
| disabled | Set to disabled state | Boolean | false | false |
Props
| Parameter | Description | Type | Default |
|---|---|---|---|
| default-value | Default value (uncontrolled state) | Array<string | number | boolean> | [] |
| direction | Arrangement direction of checkboxes | Direction | 'horizontal' |
| disabled | Whether disabled | boolean | false |
Events
| Event Name | Description | Parameters |
|---|---|---|
| change | Triggered when value changes | value: Array<string | number | boolean> |


