File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -23,12 +23,19 @@ export default function RadioButton(props) {
2323 { props . label && (
2424 < span className = "RadioButton__label" > { props . label } </ span >
2525 ) }
26+
27+ { props . children && (
28+ < div className = "RadioButton__children" >
29+ { props . children }
30+ </ div >
31+ ) }
2632 </ label >
2733 ) ;
2834}
2935
3036RadioButton . propTypes = {
3137 bordered : PropTypes . bool ,
38+ children : PropTypes . node ,
3239 disabled : PropTypes . bool ,
3340 id : PropTypes . string . isRequired ,
3441 label : PropTypes . string . isRequired ,
@@ -38,6 +45,7 @@ RadioButton.propTypes = {
3845
3946RadioButton . defaultProps = {
4047 bordered : false ,
48+ children : null ,
4149 disabled : false ,
4250 name : '' ,
4351 radioButtonProps : { } ,
Original file line number Diff line number Diff line change 1- @import ' ../../ scss/theme' ;
2- @import ' ../../ scss/borders' ;
1+ @import ' scss/theme' ;
2+ @import ' scss/borders' ;
33
44.RadioButton {
55 display : flex ;
66 align-items : center ;
77 padding : 0.5rem ;
88 border : 1px solid transparent ;
9+ flex-wrap : wrap ;
910
1011 & --bordered {
1112 border : 1px solid $ux-gray-400 ;
1617 flex-grow : 1 ;
1718 margin-left : 0.5rem ;
1819 }
20+
21+ & __children {
22+ margin-top : 0.5rem ;
23+ width : 100% ;
24+ }
1925}
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ import React from 'react';
22import { withA11y } from '@storybook/addon-a11y' ;
33import { withKnobs , text , boolean } from '@storybook/addon-knobs' ;
44
5- import RadioButton from '../ src/RadioButton/RadioButton' ;
5+ import RadioButton from 'src/RadioButton/RadioButton' ;
66
7- import { withPadding } from './decorators' ;
7+ import { withPadding } from 'stories/decorators' ;
8+ import { palette } from 'src/Styles' ;
89
910export default {
1011 title : 'Design System/Form Elements/Radio Button' ,
@@ -20,3 +21,13 @@ export const Default = () => (
2021 label = { text ( 'Label' , 'label' ) }
2122 />
2223) ;
24+
25+ export const WithChildren = ( ) => (
26+ < RadioButton
27+ label = "Option with child"
28+ bordered
29+ id = "default"
30+ >
31+ < span style = { { color : palette . uxGray500 } } > Some descriptive text for the option above</ span >
32+ </ RadioButton >
33+ ) ;
You can’t perform that action at this time.
0 commit comments