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

[material-ui][Grid] Wrapped Unstable_Grid2 containers increasing height for each word in a grid item #41212

Closed
valefar-on-discord opened this issue Feb 21, 2024 · 3 comments
Assignees
Labels
component: Grid The React component. package: material-ui Specific to @mui/material support: question Community support but can be turned into an improvement

Comments

@valefar-on-discord
Copy link

valefar-on-discord commented Feb 21, 2024

Steps to reproduce

Link to live example: (codesandbox)

The code sample shows three instances of the exact same chunk of logic:

<Grid container direction="column">
  <Grid container>
    <Grid xs={2} xsOffset={10}>
      Text
    </Grid>
  </Grid>
</Grid>

The only differences between them is the amount of words in the Grid item component, yet the height increasing based on the number of words, not the length of the text.

Current behavior

The height of the Grid item is based on the amount of words regardless of size

Expected behavior

The total size of the text would be relevant, but not the word count

Context

I am in the progress of migrating from a Material v4 to v5. I attempted using the standard Grid which completely failed and based on #29266 I decided to attempt Grid2 but am running into other issues as well.

This is an extremely simplified example of an issue I am running into.

Your environment

No response

Search keywords: Materialv5 Grid2 Unstable_Grid2 nested containers

@valefar-on-discord valefar-on-discord added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Feb 21, 2024
@zannager zannager added the component: Grid The React component. label Feb 21, 2024
@danilo-leal danilo-leal changed the title Wrapped Unstable_Grid2 containers increasing height for each word in a grid item [material-ui][Grid] Wrapped Unstable_Grid2 containers increasing height for each word in a grid item Feb 21, 2024
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Feb 21, 2024
@siriwatknp siriwatknp added support: question Community support but can be turned into an improvement and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Feb 23, 2024
@siriwatknp
Copy link
Member

I am not sure what's the full layout you want but I suggest to not use nested Grids.

@valefar-on-discord
Copy link
Author

I am not sure what's the full layout you want but I suggest to not use nested Grids.

Given you have a section in your documentation dedicated to nested grid containers I feel a "don't do that" is not an appropriate response.

I would like to add this is a regression.

As mentioned in the ticket I am working on migrated from v4 to v5. This isn't a new project I am developing and completely rewriting the layout of the application would not be ideal.

@siriwatknp
Copy link
Member

Okay, I take a deeper look. You need to explicitly specify the column size with xs, … to the BlueGrid because it is a child of a Grid container.

<BlueGrid container xs={12}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Grid The React component. package: material-ui Specific to @mui/material support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

4 participants