[Grid] Wrong grid item width for nested containers with custom columns prop
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
Cell width is calculating incorrect for nested containers with custom columns
prop.
<Grid container columns={11}>
<Grid item xs={4}>
<Grid container>
<Grid item xs={12}>
Calculated width is 109.090909%
</Grid>
</Grid>
</Grid>
<Grid item xs={4}>
<Grid container columns={12}>
<Grid item xs={12}>
Calculated width is 109.090909%
</Grid>
</Grid>
</Grid>
<Grid item xs={3}>
...
</Grid>
</Grid>
So, the value of columns
prop from top-level container is used for calculating all item widths. All nested columns
props are ignored.
I guess, this issue is related to #28554
Expected behavior 🤔
Cell width should be calculating based on columns
prop value of the parent grid container.
Steps to reproduce 🕹
No response
Context 🔦
No response
Your environment 🌎
`npx @mui/envinfo`
System:
OS: macOS 11.6.1
Binaries:
Node: 16.8.0 - /usr/local/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 7.21.0 - /usr/local/bin/npm
Browsers:
Chrome: 96.0.4664.110
Edge: Not Found
Firefox: 92.0
Safari: 15.1
npmPackages:
@emotion/react: ^11.5.0 => 11.6.0
@emotion/styled: ^11.3.0 => 11.6.0
@mui/base: 5.0.0-alpha.55
@mui/icons-material: ^5.0.4 => 5.1.1
@mui/lab: ^5.0.0-alpha.55 => 5.0.0-alpha.55
@mui/material: ^5.1.0 => 5.1.1
@mui/private-theming: 5.1.1
@mui/styled-engine: 5.1.1
@mui/system: 5.1.1
@mui/types: 7.1.0
@mui/utils: 5.1.1
@types/react: ^17.0.0 => 17.0.35
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
typescript: ^4.4.3 => 4.4.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
[Grid] Wrong grid item width for nested containers with custom ...
So, the value of columns prop from top-level container is used for calculating all item widths. All nested columns props are ignored. I...
Read more >Controlling width of column of nested grid which is an item in ...
The problem is when there is a lot of text in the right column of an item. I can't make the right column...
Read more >Subgrid - CSS: Cascading Style Sheets - MDN Web Docs
As the item spans five column tracks, this means that the subgrid has five column tracks. I can then place .subitem on this...
Read more >A Complete Guide to CSS Grid
Our comprehensive guide to CSS grid, focusing on all the settings both ... will set each item to one third the width of...
Read more >Guide to the MUI grid system - LogRocket Blog
Import the Grid component; Containers and items. Features. Spacing; Fluid grids; Auto-layout; Nested grids. Limitations of MUI.
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
@AlexKrupko indeed, this doesn’t look correct.
Thanks @boutahlilsoufiane, my 9-5 is blocking me from helping.