-
-
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] Custom slot props types #45075
Comments
@fabians-px may I ask how are you planning to combine the TreeView with the Autocomplete? From a UX perspective. @siriwatknp can you provide guidance on the best way to augment slot types? |
@aarongarciah Sure. We would like to select items from a multi-level tree structure and search/filter the tree structure using the autocomplete component. Selected items are displayed as chips as usual. This Codesandbox is a good example: https://codesandbox.io/p/sandbox/treeview-select-autocomplete-mui-yh3rmc |
@flaviendelangle do you think combining the Autocomplete and the TreeView as implemented in the sandbox from @fabians-px can work properly? I see that clicking the checkboxes causes the items to expand/collapse, which is probably a bad UX. |
@aarongarciah @flaviendelangle I want to clarify that the provided codesandbox is not mine but just an example I found while googling for "mui autocomplete treeview" with the problems mentioned above |
At first glance, I'd say that it would make more sense to have a support for nested options directly on the |
Yeah, I'm afraid that won't work properly. @fabians-px I think you're better off building a custom solution combining different components (TextField, Chip, TreeView) than mixing Autocomplete and TreeView. |
Steps to reproduce
Steps:
listbox
slot prop:Types of parameters 'props' and 'props' are incompatible. Property 'a' is missing in type 'HTMLAttributes<HTMLElement>' but required in type 'CustomListboxProps'.
Current behavior
I cannot define or extend the type of the listbox (and other) slot props when passing a custom component. For the Paper and Popper there are two interfaces
AutocompletePaperSlotPropsOverrides
andAutocompletePopperSlotPropsOverrides
that could be redeclared but that is less flexible.Expected behavior
I can use custom slots with custom props with type safety.
Context
I want to use a TreeView in the Autocomplete component. Thus I either have to replace the paper or listbox slot.
Is something like a TreeViewSelect planned at some point in the future?
Your environment
npx @mui/envinfo
Search keywords: autocomplete slot props
The text was updated successfully, but these errors were encountered: