-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Use slotProps
to forward props to .main
and .root
elements
#15870
Conversation
Deploy preview: https://deploy-preview-15870--material-ui-x.netlify.app/ Updated pages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open Question
How to port this to v7? If we treat #13522 as bug, we could port it as it is, as a bug fix.
However, since the discussion here emphasizes it to be a breaking change. To avoid it, we could only introduce slotProps.main
and keep the current behavior of passing the props to the .root
element, to at least have a workaround for the v7 users wanting to target (role="grid"
) element.
We could then make it part of the v7 -> v8
migration guide to connect the dots.
Any objections @mui/xgrid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with keeping props forwarding for v7 👍🏻
However, I would also add slotProps.root
, and if it is provided – skip the forwarding logic in useProps
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds even better. 👍
docs/data/migration/migration-data-grid-v7/migration-data-grid-v7.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with keeping props forwarding for v7 👍🏻
However, I would also add slotProps.root
, and if it is provided – skip the forwarding logic in useProps
.
Co-authored-by: Andrew Cherniavskii <[email protected]> Signed-off-by: Bilal Shafi <[email protected]>
Signed-off-by: Bilal Shafi <[email protected]>
Closes #13522
Closes #14197
Continuation of #14197, thank you @samwato for the original PR.
Motivation for the approach followed: #14197 (comment)
slotProps
to forward props to.main
and.root
elements #15870 (comment)Changelog
Breaking changes
data-*
,aria-*
) directly on the Data Grid component is no longer supported. To pass the props, useslotProps
..root
element, useslotProps.root
.main
element (the one withrole="grid"
), useslotProps.main