zent
Version:
一套前端设计语言和基于React的实现
41 lines (30 loc) • 1.93 kB
Markdown
---
title: Checkbox
path: component/checkbox
group: Data Entry
---
- Checkbox is a [controlled component][https://facebook.github.io/react/docs/forms.html#controlled-components]. You need to set the callback function `onChange` outside the component to handle the changes of `value`.
- `value` supports any type of value, inclueding Referrence Type.
| Property | Description | Type | Default | Alternative |
| ------------- | --------- | ------------- | -------- |
| checked | Whether the checkbox is selected | bool | `false` |
| value | The value of the components, which is used in `CheckboxGroup` | any | |
| disabled | Disable the checkbox | bool | |
| indeterminate | Show style of partially selection | bool | `false`|
| onChange | The callback function that is triggered when the checkbox is changed | func(e:Event) | |
| className | The custom classname | string | |
| prefix | The custom prefix | string | `'zent'` |
| Property | Description | Type | Default | Alternative |
| ------------ | --------------- | ------------------ | --------------- |
| value | The value when checkbox is checked, which is required | array<any> | `[]` |
| isValueEqual | The funtion to judge whether the value is equal | func(a, b) | `() => a === b` |
| disabled | Disable the checkbox group | bool | |
| onChange | The callback function that is triggered when the checkbox group is changed | func(checkedValueList) | |
| className | The custom classname | string | |
| prefix | The custom prefix | string | `'zent'` |
[]: https://facebook.github.io/react/docs/forms.html#controlled-components