@@ -4,10 +4,21 @@ import Radio from '@material-ui/core/Radio';
44import FormControlLabel from '@material-ui/core/FormControlLabel' ;
55import FormControl from '@material-ui/core/FormControl' ;
66import FormLabel from '@material-ui/core/FormLabel' ;
7+ import FormHelperText from '@material-ui/core/FormHelperText' ;
8+ import { wrapperProps } from '@data-driven-forms/common/src/multiple-choice-list' ;
79
8- const RadioGroup = ( { FieldProvider, options, isDisabled, input, label } ) => (
10+ const RadioGroup = ( {
11+ FieldProvider,
12+ options,
13+ isDisabled,
14+ input,
15+ label,
16+ isRequired,
17+ helperText,
18+ invalid,
19+ } ) => (
920 < div className = "mui-ddform-radio-group" >
10- < FormControl component = "fieldset" >
21+ < FormControl required = { isRequired } error = { invalid } component = "fieldset" >
1122 < FormLabel component = "legend" > { label } </ FormLabel >
1223 { options . map ( option => (
1324 < FieldProvider
@@ -26,11 +37,13 @@ const RadioGroup = ({ FieldProvider, options, isDisabled, input, label }) => (
2637 ) }
2738 />
2839 ) ) }
40+ { ( invalid || helperText ) && < FormHelperText > { invalid || helperText } </ FormHelperText > }
2941 </ FormControl >
3042 </ div >
3143) ;
3244
3345RadioGroup . propTypes = {
46+ ...wrapperProps ,
3447 FieldProvider : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . func ] ) ,
3548 options : PropTypes . arrayOf ( PropTypes . shape ( {
3649 value : PropTypes . any ,
@@ -42,6 +55,7 @@ RadioGroup.propTypes = {
4255 name : PropTypes . string . isRequired ,
4356 onChange : PropTypes . func . isRequired ,
4457 } ) ,
58+ children : PropTypes . any ,
4559} ;
4660
4761RadioGroup . defaultProps = {
0 commit comments