Skip to content

Commit

Permalink
[Form.js] Add support for vertical Radio button groups (#8414)
Browse files Browse the repository at this point in the history
This adds a vertical=true/false attribute to our wrapper. The option toggles whether the radio options are displayed vertically or horizontally on the page.
  • Loading branch information
driusan authored Mar 17, 2023
1 parent ebfc20f commit 8fe5132
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jsx/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@ class RadioElement extends React.Component {

const styleRow = {
display: 'flex',
flexDirection: 'row',
flexDirection: this.props.vertical ? 'column' : 'row',
flexWrap: 'wrap',
width: '100%',
};
Expand Down Expand Up @@ -2772,6 +2772,7 @@ RadioElement.propTypes = {
options: PropTypes.object.isRequired,
disabled: PropTypes.bool,
required: PropTypes.bool,
vertical: PropTypes.bool,
checked: PropTypes.string.isRequired,
errorMessage: PropTypes.string,
elementClass: PropTypes.string,
Expand All @@ -2780,6 +2781,7 @@ RadioElement.propTypes = {
RadioElement.defaultProps = {
disabled: false,
required: false,
vertical: false,
errorMessage: '',
elementClass: 'row form-group',
onUserInput: function() {
Expand Down

0 comments on commit 8fe5132

Please # to comment.