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.

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:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
QzSGcommented, Jul 9, 2018

Please add this to the documentation asap, was about to implement my own breakpoint styles before I found this after pages of searching

2reactions
QzSGcommented, Mar 5, 2019

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 old theme.mixins.gutters to the mentioned Container component would be nice. I am thinking if there are uses for when we do not exactly need the Container component, even though it looks pretty lightweight and flexible

Read more comments on GitHub >

github_iconTop 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 >

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