[system] Allow max-width breakpoint instead of min-width
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Summary 💡
For now, responsive values only behaves as we’re using breakpoints.up('xx')
, and there’s no way around to make it behaves like breakpoints.down('xx')
. Providing a way to change this would be useful to some developers trying to add responsiveness to their app from larger screen resolution to smaller screen resolution.
Examples 🌈
/*
* Below works same as `theme.breakpoints.up(key)`, hence previously defined padding is overriden
*/
<Paper sx={{ padding: { xs: 0 } }}>
This box has a responsive width.
</Paper>
/*
* So we need to add default style value to prevent overriding
*/
<Paper sx={{ padding: { xs: 0, md: 8 } }}>
This box has a responsive width.
</Paper>
Motivation 🔦
We’re adding responsive(mobile) UI to desktop oriented design, and we found that we need to specify original style property value(if it has one) when using sx prop’s responsive values
in material UI components(other than <Box />
)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:11 (10 by maintainers)
Top Results From Across the Web
[system] Allow max-width breakpoint instead of min-width
Summary 💡 For now, responsive values only behaves as we're using breakpoints. up('xx') , and there's no way around to make it behaves...
Read more >Max-Width vs. Min-Width - css
Min-width is the minimum width at which a style will START to be applied. (Have to be ordered from smallest to largest to...
Read more >Sizing - MUI System
Max-width. The max-width property allows setting a constraint on your breakpoints. In this example, the value resolves to theme.breakpoints.values.md .
Read more >Overview
These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes. Bootstrap primarily uses...
Read more >Approaches to Media Queries in Sass
A first step would be to store that breakpoint in a variable and use it ... You can give it a number and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since we removed the
Hidden
component in https://github.com/mui-org/material-ui/pull/26135, the migration path from thexxDown
props toxx
requires users to think mobile-first. I proposed to introduce support forxxDown
in thesx
prop to make this transition easier. My idea is the following:xs
,sm
,md
,lg
,xl
: same astheme.breakpoints.up
, nothing to change here.xsDown
,smDown
,mdDown
,lgDown
,xlDown
: same astheme.breakpoints.down
.We should encourage mobile-first, but for those users who started with desktop-first (enterprise applications) and want to add some responsiveness these props could help, instead of having to do the reverse (mobile -> desktop).
@mnajdova This would not require new flags in the theme. https://github.com/mui-org/material-ui/issues/25846#issuecomment-823154868
Actually, it’s possible in https://tailwindcss.com/docs/breakpoints#custom-media-queries. I can’t find any similar requests on styled systems or chakra.