question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add grid support for multiple device visibility breakpoints?

See original GitHub issue

Currently, you can specify only one value for the only device visibility prop on <Grid.Column/Row>. One accepted value is tablet mobile.

This means if I want a <Row> to be visible for both tablet and computer devices, I need to either duplicate the markup with different only props or manually specify className="only tablet only computer" which works but is not ideal.

Is there a reason we can’t support something like: <Grid.Row only={['tablet', 'computer']}> or <Grid.Row only="tablet computer"> Multiple values like this works in practice using the SUI css.

I think it’s a very common use case to have a column visible for all devices larger than X and another column hidden for everything smaller than Y. Or am I missing something in SUI that gives you this greater than/less than ability? It’s seems awkward to need to list all device sizes when I all I want is bigger/smaller than.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
levithomasoncommented, Feb 22, 2017

I’ve marked this as ready for development. Let’s go ahead and get this going:

Multiple only support:

<Grid.Column only='tablet mobile' />
//=> <div class="column tablet only mobile only"></div>

<Grid.Column only='desktop large screen' />
//=> <div class="column desktop only large screen only"></div>

Sugar for onlyLarger and onlySmaller:

<Grid.Column onlyLarger='desktop' />
//=> <div class="column large screen only"></div>

<Grid.Column onlySmaller='desktop' />
//=> <div class="column tablet only mobile only"></div>
0reactions
levithomasoncommented, Dec 14, 2016

The downside to largeScreen is that other two-word prop string values are not camelCased, such as attached='top right'.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use CSS Breakpoints For Responsive Design
CSS breakpoints are the points added in the code, the website content responds to these points depending on the device screen size.
Read more >
Realizing common layouts using grids - CSS - MDN Web Docs
Image of the three different layouts created by redefining our grid at two breakpoints. We're going to create this layout using the named ......
Read more >
Hide elements on different breakpoints - Webflow University
To control device-based visibility, use the breakpoint selection at the top of the Designer and set the display setting on that class to...
Read more >
Which are the correct classes for responsive visibility in ...
The documentation for Grid has a Device Visibility section which demonstrates several possible visibility modifiers:.
Read more >
Responsive UI - Layout - Material Design
Continue to grow while revealing additional content ... These breakpoints describe column and width specifications for different screens, devices, and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found