This repository has been archived by the owner on Jul 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
/
example.jsx
56 lines (53 loc) · 1.71 KB
/
example.jsx
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import { RadioGroup, RadioButton, ReversedRadioButton } from '../index.jsx';
let App = React.createClass({
onChange(value) {
console.log(value);
},
render() {
return (
<div style={ { padding: 16 } }>
<h4>Vertical Radio Buttons</h4>
<RadioGroup onChange={ this.onChange }>
<RadioButton value="apple">
Apple
</RadioButton>
<RadioButton value="orange">
Orange
</RadioButton>
<ReversedRadioButton value="melon">
Melon
</ReversedRadioButton>
</RadioGroup>
<h4 style={ { marginTop: 32 } }>Horizontal Radio Buttons</h4>
<RadioGroup onChange={ this.onChange } horizontal>
<RadioButton value="apple">
Apple
</RadioButton>
<RadioButton value="orange">
Orange
</RadioButton>
<ReversedRadioButton value="melon">
Melon
</ReversedRadioButton>
</RadioGroup>
<h4 style={ { marginTop: 32 } }>1st option disabled (prevents onChange callback and style overwrite to look disabled)</h4>
<RadioGroup onChange={ this.onChange }>
<RadioButton value="apple" disabled={true} disabledColor={'green'}>
Apple
</RadioButton>
<RadioButton value="orange">
Orange
</RadioButton>
<RadioButton value="melon">
Melon
</RadioButton>
</RadioGroup>
<h4>Check console to see the value of the RadioGroup via the onChange callback</h4>
</div>
);
}
});
ReactDOM.render(<App />, document.getElementById('content'));