Last Updated on : 2024-06-05 03:14:30download
Checkbox
is radio boxes. It is a component that provides selection function.
Note: for more information, see Checkbox Demo.
import React, { Component } from "react";
import { View } from "react-native";
import { Checkbox } from "tuya-panel-kit";
export default class CheckboxScene extends Component {
constructor(props) {
super(props);
this.state = {
checked: false,
disabled: false,
};
}
_handleChange = (checked) => {
this.setState({ checked });
};
render() {
return (
<View>
<Checkbox
checked={this.state.checked}
disabled={this.state.disabled}
onChange={(checked) => this.setState({ checked })}
>
Click to select
</Checkbox>
<Checkbox
color="red"
checked={this.state.disabled}
hideOnUnselect={true}
onChange={(disabled) => this.setState({ disabled })}
>
Click to disable the above
</Checkbox>
</View>
);
}
}
Checkbox
style.
Type | Required |
---|---|
ViewPropTypes.style | No |
Checkbox
icon size.
Type | Required | Default value |
---|---|---|
number |
No | 28 |
Whether to disable or not.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
Icon color when unchecked.
Type | Required | Default value |
---|---|---|
ColorPropType | No | null |
Whether it is checked or not.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
The checked icon path.
Type | Required | Default value |
---|---|---|
string |
No | null |
The unchecked icon path.
Type | Required | Default value |
---|---|---|
string |
No | null |
Whether to reverse the position of the checkbox icon and child elements.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
Whether to hide the unselected icon.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
checkbox
icon color.
Type | Required | Default value |
---|---|---|
ColorPropType | No | #44DB5E |
checkbox
change event.
Type | Required | Default value |
---|---|---|
(checked) => void |
No | null |
The child element of checkbox
. It is usually text.
Type | Required | Default value |
---|---|---|
any |
No | null |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback