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

sx property on Grid doesn't allow changing paddingTop #28855

Closed
OnlyJoe33 opened this issue Oct 5, 2021 · 2 comments · Fixed by #33554
Closed

sx property on Grid doesn't allow changing paddingTop #28855

OnlyJoe33 opened this issue Oct 5, 2021 · 2 comments · Fixed by #33554
Assignees
Labels
component: Grid The React component. new feature New feature or request

Comments

@OnlyJoe33
Copy link

  • [Y] The issue is present in the latest release.
  • [Y] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

<Grid item sx={{ paddingTop: 4 }}></Grid>

Padding remains at 1 spacing.
From what I can tell the "generateRowGap/ColumnGap" internal function is overriding this padding internally to work with "spacing" property on a grid. This makes it annoying to override the style for just one grid element. This should probably check if there is an existing paddingTop value first.

I assume this is the same for "paddingLeft" looking at the code.

It still works if you use "style" property on the grid item.

Expected Behavior 🤔

You would expect this to increase the paddingTop to 4 spacings.

@OnlyJoe33 OnlyJoe33 added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 5, 2021
@siriwatknp siriwatknp added component: Grid The React component. new feature New feature or request and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 6, 2021
@adamfitzgibbon
Copy link
Contributor

Taking a look!

@siriwatknp
Copy link
Member

@OnlyJoe33 Hey, we have released Grid v2 in v5.9.1 which fixes this issue. Can you give it a try?

The doc is not live but you can take a look at https://deploy-preview-33554--material-ui.netlify.app/material-ui/react-grid2/. (Here is the PR for the doc)

The usage is like this:

import Grid from '@mui/material/Unstable_Grid2';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants