[Grid] Add support for new breakpoints
See original GitHub issueI need to add xxl
breakpoint, I followed the docs to create a custom breakpoint, however, when i use the Grid
component it gives me a TS warning.
using the "@material-ui/core": "^5.0.0-alpha.33"
<Grid item xxl={1} xl={2}>
here is the custom breakpoint code
// override the BreakpointOverrides interface
declare module '@material-ui/core/styles' {
interface BreakpointOverrides {
xs: true;
sm: true;
md: true;
lg: true;
xl: true;
xxl: true;
}
}
const baseOptions: ThemeOptions = {
breakpoints: {
keys: ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'],
values: {
xs: 0,
sm: 640,
md: 768,
lg: 1024,
xl: 1280,
xxl: 1536,
},
},
};
Please advice me where i’m doing wrong.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Post Grid – Breakpoint Options - WordPress.org
Hello Livemesh-Team,. the post-grid element doesn´t seem to have options to customize the breakpoints for the responsive views.
Read more >Breakpoints · Bootstrap v5.0
Bootstrap includes six default breakpoints, sometimes referred to as grid tiers, for building responsively. These breakpoints can be customized if you're using ...
Read more >Add custom grid breakpoint - Material Design for Bootstrap
Yes, I have included all the scss files in my project. Still, couldn't change or add a new breakpoint. I have found similar...
Read more >How To Use CSS Breakpoints For Responsive Design
In this approach, we simply set a breakpoint at each point where the content layout is misaligned. This method greatly simplifies the ...
Read more >Realizing common layouts using grids - CSS - MDN Web Docs
Something to note as we create this layout is that we haven't needed to explicitly position every element on the grid at each...
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
I’ve just did a review, sorry for the delay. It’s important that we resolve https://github.com/mui/material-ui/pull/31998#pullrequestreview-949788800 before moving forward.
For anyone else banging their head against a brick wall that has ended up here looking for a workaround to this issue, this is what ended up working for me…
On every Grid component you have to specify the columns you want for your custom breakpoints (
columns={{ mobile: 4, tablet: 8, desktop: 12 }}
), so it’ll be worth creating a wrapper. You then have to add a prop with the name of your breakpoint and the value you want, iedesktop={8}
, however TypeScript doesn’t like this as these props don’t exist on theMuiGrid
component, which is why I’ve used{...{ mobile: 4, tablet: 4, desktop: 8 }}
. This will also work as expected if you only specify some of the breakpoints;{...{ tablet: 4 }}
.