-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[material-ui][TablePagination] Add ability to change icons in TablePaginationActions using slots
and slotProps
#33797
[material-ui][TablePagination] Add ability to change icons in TablePaginationActions using slots
and slotProps
#33797
Conversation
Netlify deploy previewhttps://deploy-preview-33797--material-ui.netlify.app/ @material-ui/core: parsed: +0.10% , gzip: +0.07% Bundle size reportDetails of bundle changes (Toolpad) |
Thanks
…On Thu, Aug 4, 2022, 5:49 AM MUI Bot ***@***.***> wrote:
Bundle size will be reported once CircleCI build #413347
<https://app.circleci.com/pipelines/github/mui/material-ui/jobs/413347>
finishes.
Generated by 🚫 dangerJS <https://danger.systems/js> against 181edc0
<181edc0>
—
Reply to this email directly, view it on GitHub
<#33797 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2KTIJ54JYFJ25GNFSZMBVTVXON33ANCNFSM55SBV7CQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
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.
Please also add componentsProps
for allowing people to specify additional props if needed on these slots.
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.
Should we also support callbacks? cc @michaldudak
It's not crucial here (there is no real ownerState in TablePaginationActions component), but I suppose at some point we'd like to have components/componentProps in every component in Material UI and have it consistent with Base/Joy. So it doesn't have to be in this PR, but we'll need it sometime in the future. |
I agree that the icons should be customizable but I am not satisfied with the |
Hi @siriwatknp, please update the PR with the approach once you have a conclusion on the components prop. |
Sure! so sorry for the delay. |
This pattern is seen in DatePicker, and now Alert as well |
Any updates on this? As far as I know, I think we finally decided to use |
@ZeeshanTamboli I'll fix this. |
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.
@pratikkarad I made the expected changes. Thank you for the PR.
@DiegoAndai Could you please review this?
@ZeeshanTamboli API design might be confusing, as the
Would that work? |
@DiegoAndai, I considered using slots for buttons <TablePagination
....
....
slotProps={{
actions: {
firstButton: {
component: 'button', // HTML element or a React element
},
},
}}
/>; I found information about this here: #34334 (comment). Yes, but the API design for properties differs between
(edited) |
I wouldn't say it's necessary, but IMO, it's a clearer API design. I wouldn't break it unless strictly necessary. Pure speculation here: If the slots from the
Yes, what do you think about doing that instead? |
@DiegoAndai To be honest, I don't like it. It's too nested: Instead, I propose slots |
@ZeeshanTamboli I guess the "rule" we could follow is to have slots for components instantiated inside the parent. If that's the "rule", we could have slots for the icons as those are instantiated in the So I would be on board with: A question that arises now is how these should behave regarding right-to-left mode. Would the user expect, for example, for Sidenote:
I realized that we made a mistake in that PR. It should be |
Alright, I'll make the changes.
Certainly, it should switch successfully with custom slots since it already functions without them: https://codesandbox.io/p/sandbox/inspiring-hofstadter-8pzmn9?file=%2Fsrc%2Findex.tsx%3A22%2C4.
Hmm, but if this is done now it would be a breaking change. |
Yes 😅 I was just noting it. |
slots
and slotProps
@DiegoAndai This is ready for review. Also, here is the CodeSandbox demonstrating custom action slots with RTL mode. |
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.
Glad to get this one done 😊 good work 🎉
slots
and slotProps
slots
and slotProps
I have tested this fix locally and also tested using a preview package on CodeSandbox.
Closes #33231