ReactJS align material-ui elements horizontally

馋奶兔 提交于 2019-12-04 11:10:44

Just for the record, I managed to align radio buttons using flexboxgrid... Did something like this:

      <div className="row">
        <div className="col-md-2">
          Type:
        </div>
        <div className="col-md-10">
          <RadioButtonGroup
             className="row"
             name="type">
            <RadioButton
               className="col-md-4"
               value="other"
               label="Other" />
            <RadioButton
               className="col-md-4"
               value="custom"
               label="Custom" />
          </RadioButtonGroup>
        </div>
      </div>

I'm using react-inline-grid for layout with material-ui, it helps solve many problems and makes code more explicit about layout (plus it's reactive).

<Grid>
  <Row is="nospace start">
    <Cell is="9 tablet-6 phone-3">
       <TextField ... />
    </Cell>
    <Cell is="middle 3 tablet-2 phone-1">
       <RaisedButton ... />
    </Cell>
  </Row>
</Grid>

You have a style object available to override the default styles of the element in Material-Ui. Use that and set display to inline-block.

display: inline-block;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!