material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Autocomplete] Pass getOptionLabel as a parameter to renderOption

Open nicolas-ot opened this issue 2 years ago • 1 comments

Related to #33423.

nicolas-ot avatar Apr 23 '23 13:04 nicolas-ot

Netlify deploy preview

Bundle size report

Details of bundle changes (Toolpad) Details of bundle changes

Generated by :no_entry_sign: dangerJS against 4de3fc1d8fa72e8a4c8f43e9f6c0f8f1f76726ef

mui-bot avatar Apr 23 '23 13:04 mui-bot

@ZeeshanTamboli please review

nicolas-ot avatar May 24 '23 19:05 nicolas-ot

@ZeeshanTamboli i will now also add the same for Autocomplete in JoyUI. I've made the demo for material UI. Should I add a similar demo too for Joy UI?

You can check the demo here : demo

edit: renderOption of Autocomplete of JoyUI actually already has ownerState in the parameter. So I think I've done all of your review. Please re-review :)

nicolas-ot avatar May 29 '23 16:05 nicolas-ot

@ZeeshanTamboli that is unfortunate, I didn't realize that. Personally I believe this demo is useful to show how you can easily customize the component for the whole app. I think it's important because one of the main reason people might be reluctant to use Material UI is that they might not really be too fond of Material Design and they don't know that Material UI is easily customizable like that.

It also showcases how to utilise ownerState. It's true that the API docs also explains it, but a quick glance on the demo with all the same styling might push user to find other alternative before finding the API.

As for using useTheme, I think a simple comment above it such as "to determine dark/light mode" should suffice. It might not be ideal, but the advantage far outweights the disadvantage.

nicolas-ot avatar May 31 '23 16:05 nicolas-ot

@nicolas-ot I'm discussing it with the team and will inform you about the next steps.

If you want to research till then, this is how I did it recently in #36805.

ZeeshanTamboli avatar Jun 01 '23 08:06 ZeeshanTamboli

@ZeeshanTamboli any update?

nicolas-ot avatar Jun 15 '23 10:06 nicolas-ot

@ZeeshanTamboli any update?

@nicolas-ot We haven't found a solution yet because the demo creates a new theme. Let's go ahead by using the useTheme hook and adding a comment explaining its purpose in determining light/dark mode. Afterward, we can seek someone else's opinion on it.

ZeeshanTamboli avatar Jun 15 '23 14:06 ZeeshanTamboli

I would do that, but would it be possible to seek someone's else opinion first before I actually implemented it? @ZeeshanTamboli

nicolas-ot avatar Jun 16 '23 12:06 nicolas-ot

@michaldudak, what are your thoughts on this? I've talked to @siriwatknp about the demo theme, but we haven't found a solution yet. How do you propose we move forward?

ZeeshanTamboli avatar Jun 17 '23 07:06 ZeeshanTamboli

I'm OK with useTheme, but let's also add a comment explaining why it's needed.

michaldudak avatar Jun 19 '23 18:06 michaldudak

@ZeeshanTamboli I've changed it as discussed. Please review.

nicolas-ot avatar Jun 25 '23 21:06 nicolas-ot

@ZeeshanTamboli I'm done updating. Please review again

nicolas-ot avatar Jun 28 '23 12:06 nicolas-ot

please review @ZeeshanTamboli

nicolas-ot avatar Jul 09 '23 16:07 nicolas-ot