How to break a row in the grid?
Hello,
I can't find it in the docs, but how do you break a row after a certain cell in the grid ? For example, how do I get the following layout ?
X X X X X X X X X
On a smaller screen, it would look like:
X X X X X X X X X
Thanks so much
There may be a better way to do this, but I would add a spacer that's hidden on smaller screens.
http://codepen.io/westy92/pen/qNXmWR
<div class="mdl-grid">
<div class="mdl-cell mdl-cell--6-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">X X X</div>
<div class="mdl-cell mdl-cell--6-col mdl-cell--hide-tablet mdl-cell--hide-phone"></div>
<div class="mdl-cell mdl-cell--6-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">X X X</div>
<div class="mdl-cell mdl-cell--6-col mdl-cell--8-col-tablet mdl-cell--4-col-phone">X X X</div>
</div>
@westy92 Thanks a lot that works! For me this feature is particularly important for forms where I have a lot of inputs and I can't have them all one after the other.
Even though this works perfectly, I feel there should be a "native", more elegant way of handling this so I am leaving this issue open for now.
Unfortunately the solution didn't end up working well (because of all the different possible layout combinations) so the only way for now is really to have an mdl-grid per row.
@westy92's solution is the current recommended solution. If you need something more complex then you're probably better of building your own setup for handling the form.
Thanks again for your answers. I am using Material UI and just needed a grid so in the end I'll be using http://flexboxgrid.com/ which works well for me for a couple of additional reasons:
The column / rows setup is more intuitive. Overall it has more options.
It's a lightweight css-only solution, so works well with dynamically-added elements (no need to use componentHandler.upgradeElement)
It handles well 0px margins for the leftmost and rightmost elements.
You can add <Grid sm={12}/> after the first three elements.