-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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][Autocomplete] Passing slotProps
to the TextField
in renderInput
throws an error
#43573
Comments
slotProps
to the TextField
in renderInput
throws an errorslotProps
to the TextField
in renderInput
throws an error
@DiegoAndai do you think this issue should be added to Material-UI v6 issues board? |
@sai6855 I just added it to the v6 issues board. |
@ClementDreptin - I am definitely experiencing some odd behaviors since upgrading to v6. In general, I feel like what is being passed as However, I've had some luck by spreading the
|
for what its worth, this seems to fail on all TextField input adornment props. Autocomplete uses TextField so that's why there's an issue here. See the problem here - https://codesandbox.io/p/sandbox/broken-text-field-adornment-8zhlqc?file=%2Fsrc%2FApp.tsx%3A53%2C72&workspaceId=bdebcbbe-982a-40d5-9c2e-b543cf24c982 |
I had same problem with autocomplete throwing, and @mjkstudios solution worked. DatePickers also broke silently, and were also fixed by the same change, I think they also pass old |
Steps to reproduce
Link to live example: https://stackblitz.com/edit/react-1qmjam?file=Demo.tsx
Steps:
Autocomplete
to see the errorCurrent behavior
I found 2 strange behaviors
{ htmlInput: { ... } }
more padding is added and clicking in the input throws an error.{ input: { ... } }
theendAdornment
disappears and clicking in input doesn't open the list of options.Expected behavior
I expect to be able to use
slotProps.input
the same way I was usingInputProps
andslotProps.htmlInput
the same way I was usinginputProps
.Context
In our app we have an
Autocomplete
with a customendAdornment
. We are adding another adornment before the existing one to be exact. I was trying to migrate fromInputProps
andinputProps
toslotProps
since they became deprecated in MUI v6.Before migrating the code looked like this (which is still working in v6 but won't in v7):
After the migration the code looks like this:
Both adornments disappeared and the list of options isn't displaying on focus anymore.
Your environment
npx @mui/envinfo
Search keywords: Autocomplete slotProps
The text was updated successfully, but these errors were encountered: