[DataGrid] Use slotProps to forward props to .main and .root elements#15870
[DataGrid] Use slotProps to forward props to .main and .root elements#15870MBilalShafi merged 8 commits intomui:masterfrom
slotProps to forward props to .main and .root elements#15870Conversation
|
Deploy preview: https://deploy-preview-15870--material-ui-x.netlify.app/ Updated pages: |
There was a problem hiding this comment.
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.
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.
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.
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 <andrew.cherniavskii@gmail.com> Signed-off-by: Bilal Shafi <bilalshafidev@gmail.com>
Signed-off-by: Bilal Shafi <bilalshafidev@gmail.com>
…ements (mui#15870) Signed-off-by: Bilal Shafi <bilalshafidev@gmail.com> Co-authored-by: Andrew Cherniavskii <andrew.cherniavskii@gmail.com>
…ements (mui#15870) Signed-off-by: Bilal Shafi <bilalshafidev@gmail.com> Co-authored-by: Andrew Cherniavskii <andrew.cherniavskii@gmail.com>
Closes #13522
Closes #14197
Continuation of #14197, thank you @samwato for the original PR.
Motivation for the approach followed: #14197 (comment)
slotPropsto forward props to.mainand.rootelements #15870 (comment)Changelog
Breaking changes
data-*,aria-*) directly on the Data Grid component is no longer supported. To pass the props, useslotProps..rootelement, useslotProps.root.mainelement (the one withrole="grid"), useslotProps.main