You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Child <Grid2/> components continue to inherit spacing from upper-most <Grid2/> parent even if their spacing or their immediate parents spacing value is overridden.
Expected behavior 🤔
I think there could be 2 remedies to this:
A way to prevent inheriting spacing from parent <Grid2/> components. This could be in the form of a disableSpacingInheritance prop that could be set on the top-level <Grid2/> and would remove spacing inheritance for all <Grid2/> children it may have. This value could also be passed into the themes defaultProps object for Grid2 to disable spacing inheritance for a whole project.
If we truly want to inherit spacing by default, maybe its made so that child <Grid2/> components will inherit spacing from their nearest parent that has the spacing prop explicitly set, as opposed to inheriting the value from the upper-most parent.
My use case would have 1 prioritized over 2 but I think both would be good features for this.
Context 🔦
It would be nice to have a way to prevent <Grid2/> from inheriting spacing to restore functionality of the original MUI 4/5 <Grid/>.
I also think it would also be nice that, if spacing was to be inherited, it would be inherited from the closest parent that has spacing explicitly set.
More details of this are given in the Expected Behavior section
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example:
https://codesandbox.io/s/optimistic-waterfall-qhrh60?file=/src/App.tsx
Current behavior 😯
Child
<Grid2/>
components continue to inherit spacing from upper-most<Grid2/>
parent even if theirspacing
or their immediate parentsspacing
value is overridden.Expected behavior 🤔
I think there could be 2 remedies to this:
A way to prevent inheriting spacing from parent
<Grid2/>
components. This could be in the form of adisableSpacingInheritance
prop that could be set on the top-level<Grid2/>
and would remove spacing inheritance for all<Grid2/>
children it may have. This value could also be passed into the themesdefaultProps
object forGrid2
to disable spacing inheritance for a whole project.If we truly want to inherit spacing by default, maybe its made so that child
<Grid2/>
components will inherit spacing from their nearest parent that has thespacing
prop explicitly set, as opposed to inheriting the value from the upper-most parent.My use case would have 1 prioritized over 2 but I think both would be good features for this.
Context 🔦
It would be nice to have a way to prevent
<Grid2/>
from inheriting spacing to restore functionality of the original MUI 4/5<Grid/>
.I also think it would also be nice that, if spacing was to be inherited, it would be inherited from the closest parent that has
spacing
explicitly set.More details of this are given in the Expected Behavior section
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: