-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Grid container in CardActions no longer take the whole width #44201
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
Comments
After some complementary research the same behavior is happenning in |
Did some initial investigation, regression seems to stem from absense of I've checked migration guide to GridV2 https://mui.com/material-ui/migration/migration-grid-v2/, there is no mention of removal of Added GridV1 demos to OP's sandbox to clearly see differences in behaviour in 2 versions |
@siriwatknp @zannager Can you give an update? This is currently blocking our migration and we would like to know if this is something we have to change on our side, or if you'll fix this in core. Thanks, |
@ACayet @ddolcimascolo @sai6855 Grid2 is a rewrite of Grid1. I don't think it's a good practice to set In this issue, I'd recommend to use <CardActions>
<Grid sx={{ flex: 1 }}>…
</CardActions> Note: Be cautious, it seems like you are overuse the Grid component and make the layout too complex. The Grid layout is useful for organizing layout with media query for a page layout but what you are doing is putting the Grid inside a component which I don't recommend because the Card is a component, not a page. The width varies when it's placed in different containers. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @ACayet How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
@siriwatknp do you think removal of |
Hi @sai6855, I agree with you here, I couldn't find anything written about it on the migration guide and it caused us a ton of adoption issues, can we write a small note on the docs about it please @siriwatknp |
Same here, I'm thinking of adding back |
We have this problem as well. I think at the very least this change should be mentioned in the migration guide. |
Isn't this a re-definition of how the Grid component should be used?! In our project we use Grid extensively for all kinds of layouts. Migrating to Grid2 breaks 220 files which use Grid which will need some sort of manual change and testing. This is not trivial. Can the migration guide be more thorough, to explain and provide solutions for all the breaking changes please? |
Sure, feel free to update the docs and tag me. |
Steps to reproduce
Link to live example: (CodeSandbox)
Steps:
Current behavior
The Grid container does not take the whole width of the CardActions.
Expected behavior
The Grid container should take the whole width of the CardActions.
In Grid v1 the Grid container had a width css property to 100% (with a calc to take into account margin).
Context
I am trying to migrate from Grid v1 to Grid v2. The code to migrate contains a lot of CardActions containing Grid containers with
justifyContent: 'flex-end'
that are as a consequence on the left side of the CardActionsYour environment
npx @mui/envinfo
Search keywords: Grid Container CardActions Grid2 Width
The text was updated successfully, but these errors were encountered: