-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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
[Autocomplete] Enable global customization of different options #36971
[Autocomplete] Enable global customization of different options #36971
Conversation
Netlify deploy previewBundle size reportDetails of bundle changes (Toolpad) |
@ZeeshanTamboli please review |
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.
We should add the same in Joy UI's Autocomplete. Also adding demos demonstrating the use-case shown in #33423 (comment) would be great.
@ZeeshanTamboli i will now also add the same for You can check the demo here : demo edit: |
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.
@nicolas-ot The Autocomplete in the demo is not visible in light mode because the demo's ThemeProvider
overrides the docs' internal ThemeProvider
. To determine the color mode of the docs, useTheme
would need to be used, but this may not be a good demonstration for developers who would question the need for useTheme. Therefore, in my opinion, the best solution currently is to not showcase a demo and let developers rely on the API docs instead. What are your thoughts?
@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 As for using |
@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 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 |
I would do that, but would it be possible to seek someone's else opinion first before I actually implemented it? @ZeeshanTamboli |
I'm OK with |
@ZeeshanTamboli I've changed it as discussed. Please review. |
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Show resolved
Hide resolved
@ZeeshanTamboli I'm done updating. Please review again |
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.
Looks generally good! Just two more comments.
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
docs/data/material/components/autocomplete/GloballyCustomizedOptions.tsx
Outdated
Show resolved
Hide resolved
please review @ZeeshanTamboli |
…/nicolas-ot/material-ui into autocomplete-pass-getOptionLabel
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.
@nicolas-ot It looks good to me. Nice work.
getOptionLabel
available through renderOption
getOptionLabel
available through renderOption
Closes #33423.
getOptionLabel
can now be extracted throughownerState
as fourth parameter torenderOption
This PR also add a test to check that
getOptionLabel
can be called throughownerState
and that the function works properly.New feature in action: codesandbox