Document theme.mixins.gutters()
See original GitHub issue- This is a v1.x issue (v0.x is no longer maintained).
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
I was following https://material-ui.com/layout/grid/ to get a basic app set up. After copying and pasting the examples on that page, the grid had no gutter on the left and right hand side of the page.
Adding theme.mixins.gutters()
to the root class produced the behaviour I wanted.
const styles = theme => ({
root: {
...theme.mixins.gutters(),
flexGrow: 1
}
});
Current Behavior
I first looked at the example apps, but these were all centred, so didn’t suffer from the same issue. Next, I dug through the source code of the Toolbar, which did what I expected, where I found the mixin.
This seems pretty essential for building any left-aligned app, so I would have expected it to be in the getting started guide. I had a bad on-boarding experience due to this.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:16
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Document theme.mixins.gutters() #11539 - mui/material-ui
Adding theme.mixins.gutters() to the root class produced the behaviour I wanted. const styles = theme => ({ root: ...
Read more >Material-ui overwrite components gutter breakpoint styles ...
Regarding the "global" gutter property, Toolbar uses theme.mixins.gutters() to get the default gutter, so I think you have to override that.
Read more >Breaking changes in v5, part one: styles and themes - MUI
The following document lists all breaking changes related to styles and themes ... -theme.mixins.gutters(), +paddingLeft: theme.spacing(2), +paddingRight: ...
Read more >Toolkit — Susy 2.2.12 documentation - Read the Docs
Use the mixin version to apply gutters to any element. Gutters are output as margin or padding depending on the gutter-position setting. //...
Read more >React: Theming with Material UI - Ross Bulat - Medium
The gutters() mixin provides spacing properties. ... Create a theme.js file to host the theme, and use Material UI's createMuiTheme utility ...
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
Please add this to the documentation asap, was about to implement my own breakpoint styles before I found this after pages of searching
A quick code search on GitHub lists lots of existing MUI sites using
theme.mixins.gutters
for responsive left and right padding (gutters) between desktop and mobile screens. Not sure if official documentation were ever added for the gutters mixin, but the fact that thousands (44k on a rough search albeit most should no longer be maintained) of repositories are using the same mixin in their existing MUI styles seem to suggest it being a popular method to settle responsive gutters. I guess a small article on migrating from the oldtheme.mixins.gutters
to the mentionedContainer
component would be nice. I am thinking if there are uses for when we do not exactly need theContainer
component, even though it looks pretty lightweight and flexible