Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Grid] Spacing on grid causes horizontal scrolling #25783

Closed
BiancaArtola opened this issue Apr 15, 2021 · 1 comment
Closed

[Grid] Spacing on grid causes horizontal scrolling #25783

BiancaArtola opened this issue Apr 15, 2021 · 1 comment
Labels
component: Grid The React component. duplicate This issue or pull request already exists

Comments

@BiancaArtola
Copy link

BiancaArtola commented Apr 15, 2021

I am using the Material UI library on my project. I use the Grid component and I am having some issues when I add the property spacing to the Grid container.
When I add the spacing (in this case only 1), the CSS is updated to:

image

With these props, the scrollbar appears on my screen that allows me to scroll horizontally. I don't want this, I only want to add some padding between my rows.

I read several people that also have this issue on the internet, but I don't like the solutions that they proposed. I think that an internal fix is needed on the library.

Here is my code:

<Grid container className={classes.container} spacing={1}>
      <Grid item xs={12}>
        <Typography type="h2">Test info</Typography>
      </Grid>
      <Grid item xs={11} md={9} lg={7}>
        <Card>
          <Grid container spacing={1}>
            <Grid item xs={4} md={4} lg={4}>
              <Typography type="h2">Test info</Typography>
            </Grid>
            <Grid item xs={8} md={8} lg={8}>
              <Input onChange={() => console.log("test")} />
            </Grid>
            <Grid item xs={4} md={4} lg={4}>
              <Typography type="h2">Test info</Typography>
            </Grid>
            <Grid item xs={8} md={8} lg={8}>
              <Input onChange={() => console.log("test")} />
            </Grid>
            <Grid item xs={4} md={4} lg={4}>
             <Typography type="h2">Test info</Typography>
            </Grid>
            <Grid item xs={8} md={8} lg={8}>
              <Input onChange={() => console.log("test")} />
            </Grid>
          </Grid>
        </Card>
      </Grid>
    </Grid>

-----

const useStyles = makeStyles(() =>
  createStyles({
    container: {
      padding: "1rem",
      height: "fit-content",
    },
  })
);

Can you please help?
Thanks

@BiancaArtola BiancaArtola added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 15, 2021
@BiancaArtola BiancaArtola changed the title Spacing on grid causes horizontal scrolling [Grid] Spacing on grid causes horizontal scrolling Apr 15, 2021
@oliviertassinari oliviertassinari added component: Grid The React component. duplicate This issue or pull request already exists and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 15, 2021
@oliviertassinari
Copy link
Member

Duplicate of #7466

@oliviertassinari oliviertassinari marked this as a duplicate of #7466 Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants