Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column - missing an order prop #97

Open
zolza opened this issue Jan 9, 2018 · 4 comments
Open

Column - missing an order prop #97

zolza opened this issue Jan 9, 2018 · 4 comments

Comments

@zolza
Copy link

zolza commented Jan 9, 2018

Is there any way of changing the order of elements depending on breakpoints? For now I can only hide and show elements but it does not seem like a proper solution?

@LoicMahieu
Copy link
Owner

Hi @zolza
I don't really understand the problem ;) Could you please post a codesandbox or other to illustrate it ?
Thanks!

@joetidee
Copy link

I have the same request. For example, it would be good to be able to set the order of the columns based on the viewport. Perhaps something like this:

<Grid>
  <Row order={{
    xs: [3,2,1],
    sm: [1,3,2],
  }}>
    <Col>
      ...
    </Col>
    <Col>
      ...
    </Col>
    <Col>
      ...
    </Col>
  </Row>
</Grid>

Maybe utilizing the flex order property:
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Ordering_Flex_Items

Note that in the above example, if the page is viewed at a viewport that is not specified, the columns will order naturally.

In addition, it would also be handy to do something similar with the column reverse prop so that, in addition to taking a boolean value, it could take either xs,sm,md or lg so that the columns would reverse only at a specific viewport size.

@vemundeldegard
Copy link

Hello!

I am missing the same.

By default, flex items are laid out in the source order. However, the order property controls the order in which they appear in the flex container. .item { order: <integer>; /* default is 0 */ }

@LoicMahieu
Copy link
Owner

Thanks for explanation.
Yep indeed it could be useful. I don't have time to work on this but feel free to try to implement it and submit a PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants