-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
/
Switches.js
37 lines (33 loc) · 876 Bytes
/
Switches.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import Switch from '@material-ui/core/Switch';
class Switches extends React.Component {
state = {
checkedA: true,
checkedB: true,
};
handleChange = name => event => {
this.setState({ [name]: event.target.checked });
};
render() {
return (
<div>
<Switch
checked={this.state.checkedA}
onChange={this.handleChange('checkedA')}
value="checkedA"
/>
<Switch
checked={this.state.checkedB}
onChange={this.handleChange('checkedB')}
value="checkedB"
color="primary"
/>
<Switch value="checkedC" />
<Switch disabled value="checkedD" />
<Switch disabled checked value="checkedE" />
<Switch defaultChecked value="checkedF" color="default" />
</div>
);
}
}
export default Switches;