-
-
Notifications
You must be signed in to change notification settings - Fork 32.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
[Autocomplete] Streamline Mapping Value to Options #44863
Comments
@aarongarciah the ticket you have linked is not related to my request. I would want to see a |
You mentioned in the issue description the possibility of introducing a |
@aarongarciah seems like a fix to #31192 would solve my issue. Using the options in getOptionLabel that is currently selected via the isOptionSelected check rather than the value would allow decoupling the value to process/send to backend to the text to display. |
@aarongarciah do you have an eta for the fix? It seems that the linked tickets have been ignored for a while. |
No ETA, sorry. Base UI will be working on a new Combobox in 2025 and the intention is that Material UI then rewrites the Autocomplete on top of it. But we're far from that so I can't give any specifics. Not sure if we'll change the Autocomplete implementation before the rewrite to be honest. |
Summary
Currently, when using non-flattened options (e.g., an array of objects), if the value is set to a property such as the
id
, we must explicitly locate the corresponding option to set it as the selected value. This approach introduces boilerplate code and can lead to errors when interacting with the component. It negatively impacts the developer experience (DX).It would be great to introduce a
valueFromOption
or a similar feature to streamline this process, removing the need for the additional code shown below. This enhancement would make the component more generic and adaptable to both flattened and non-flattened options.Examples
Motivation
See above.
Search keywords: autocomplete, options, value
The text was updated successfully, but these errors were encountered: