1- import * as React from 'react' ;
21import Formsy from 'formsy-react' ;
2+ import * as React from 'react' ;
33import {
44 Container ,
55 Button ,
99 Checkbox ,
1010 Message ,
1111} from 'semantic-ui-react' ;
12- import { RadioGroup } from '../src' ;
12+ import { RadioGroup , Form } from '../src' ;
1313
1414const styles = {
1515 root : {
@@ -20,11 +20,6 @@ const styles = {
2020 display : 'flex' ,
2121 marginBottom : 18 ,
2222 } ,
23-
24- radio : {
25- marginLeft : 4 ,
26- marginRight : 12 ,
27- } ,
2823} ;
2924
3025export default class RadioGroupExamples extends React . Component {
@@ -39,6 +34,23 @@ export default class RadioGroupExamples extends React.Component {
3934 const errorLabel = < Label color = "red" pointing = "left" /> ;
4035
4136 const radioGroup = (
37+ < RadioGroup
38+ name = "radioGroup"
39+ required
40+ label = "Label"
41+ validationErrors = { {
42+ isDefaultRequiredValue : 'Please select one of these' ,
43+ } }
44+ errorLabel = { errorLabel }
45+ style = { styles . radioGroup }
46+ >
47+ < Radio label = "one" value = "one" />
48+ < Radio label = "two" value = "two" />
49+ < Radio label = "three" value = "three" />
50+ </ RadioGroup >
51+ ) ;
52+
53+ const disabledRadioGroup = (
4254 < RadioGroup
4355 name = "radioGroup"
4456 required
@@ -48,9 +60,9 @@ export default class RadioGroupExamples extends React.Component {
4860 errorLabel = { errorLabel }
4961 style = { styles . radioGroup }
5062 >
51- < Radio label = "one" value = "one" style = { styles . radio } />
52- < Radio label = "two" value = "two" style = { styles . radio } />
53- < Radio label = "three" value = "three" style = { styles . radio } />
63+ < Radio label = "one" value = "one" />
64+ < Radio label = "two" value = "two" />
65+ < Radio label = "three" value = "three" />
5466 </ RadioGroup >
5567 ) ;
5668
@@ -64,9 +76,9 @@ export default class RadioGroupExamples extends React.Component {
6476 errorLabel = { errorLabel }
6577 style = { styles . radioGroup }
6678 >
67- < Checkbox label = "one" value = "one" style = { styles . radio } />
68- < Checkbox label = "two" value = "two" style = { styles . radio } />
69- < Checkbox label = "three" value = "three" style = { styles . radio } />
79+ < Checkbox label = "one" value = "one" />
80+ < Checkbox label = "two" value = "two" />
81+ < Checkbox label = "three" value = "three" />
7082 </ RadioGroup >
7183 ) ;
7284
@@ -81,10 +93,10 @@ export default class RadioGroupExamples extends React.Component {
8193 errorLabel = { errorLabel }
8294 style = { styles . radioGroup }
8395 >
84- < Checkbox label = "one" value = "one" style = { styles . radio } />
85- < Radio toggle label = "two" value = "two" style = { styles . radio } />
86- < Radio slider label = "three" value = "three" style = { styles . radio } />
87- < Radio label = "four" value = "four" style = { styles . radio } />
96+ < Checkbox label = "one" value = "one" />
97+ < Radio toggle label = "two" value = "two" />
98+ < Radio slider label = "three" value = "three" />
99+ < Radio label = "four" value = "four" />
88100 </ RadioGroup >
89101 ) ;
90102
@@ -99,22 +111,52 @@ export default class RadioGroupExamples extends React.Component {
99111 errorLabel = { errorLabel }
100112 style = { styles . radioGroup }
101113 >
102- < Checkbox label = "one" value = "one" style = { styles . radio } />
103- < Checkbox label = "two" value = "two" style = { styles . radio } />
104- < Checkbox label = "three" value = "three" style = { styles . radio } />
114+ < Checkbox label = "one" value = "one" />
115+ < Checkbox label = "two" value = "two" />
116+ < Checkbox label = "three" value = "three" />
105117 </ RadioGroup >
106118 ) ;
107119
108120 return (
109121 < Container style = { styles . root } >
110- < Formsy
111- noValidate = { true }
112- onValidSubmit = { this . onValidSubmit }
113- ref = { this . formRef }
114- >
122+ < Form onValidSubmit = { this . onValidSubmit } ref = { this . formRef } >
115123 < Segment >
116124 < h5 > RadioGroup </ h5 >
117125 { radioGroup }
126+
127+ < h5 > Grouped</ h5 >
128+ < RadioGroup
129+ name = "radioGroup"
130+ required
131+ inline = { false }
132+ label = "Label"
133+ validationErrors = { {
134+ isDefaultRequiredValue : 'Please select one of these' ,
135+ } }
136+ errorLabel = { errorLabel }
137+ style = { styles . radioGroup }
138+ >
139+ < Radio label = "one" value = "one" />
140+ < Radio label = "two" value = "two" />
141+ < Radio label = "three" value = "three" />
142+ </ RadioGroup >
143+
144+ < h5 > Disabled</ h5 >
145+ < RadioGroup
146+ name = "radioGroup"
147+ required
148+ disabled = { true }
149+ label = "Label"
150+ validationErrors = { {
151+ isDefaultRequiredValue : 'Please select one of these' ,
152+ } }
153+ errorLabel = { errorLabel }
154+ style = { styles . radioGroup }
155+ >
156+ < Radio label = "one" value = "one" />
157+ < Radio label = "two" value = "two" />
158+ < Radio label = "three" value = "three" />
159+ </ RadioGroup >
118160 </ Segment >
119161
120162 < Segment >
@@ -143,7 +185,7 @@ export default class RadioGroupExamples extends React.Component {
143185 content = "Reset"
144186 color = "black"
145187 />
146- </ Formsy >
188+ </ Form >
147189 { ! ! this . state . result && (
148190 < Message >
149191 < pre > { this . state . result } </ pre >
0 commit comments