35 lines
694 B
Plaintext
35 lines
694 B
Plaintext
class TestCheckbox extends React.Component {
|
|
state = {
|
|
check1: true,
|
|
check2: false
|
|
};
|
|
|
|
handleChange = (field, value) => {
|
|
this.setState({[field]: value});
|
|
};
|
|
|
|
render () {
|
|
return (
|
|
<div>
|
|
<Checkbox
|
|
checked={this.state.check1}
|
|
label="Checked option"
|
|
onChange={this.handleChange.bind(this, 'check1')}
|
|
/>
|
|
<Checkbox
|
|
checked={this.state.check2}
|
|
label="Unchecked option"
|
|
onChange={this.handleChange.bind(this, 'check2')}
|
|
/>
|
|
<Checkbox
|
|
checked
|
|
disabled
|
|
label="Disabled checkbox"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
return <TestCheckbox />;
|