-
-
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
[material-ui][TextField] Props passed in inputProps
are not attached when slotProps.htmlInput
is passed
#44320
Comments
I'd say that this is expected in v6. The @sai6855 I think we missed the documentation about it, what do you think? cc @DiegoAndai Note: merging props could be overcomplicated (the slotProps.* supports function). Might be better to teach users to migrate to |
For #43606, I think lets add a document or a demo that shows which props to passed to TextField's slotProps: <Autocomplete
options={top100Films}
renderInput={(params) => (
<TextField
{...params}
slotProps={{
input: {
className: 'custom-input-wrapper',
…params.InputProps,
},
htmlInput: {
id: 'my-id',
…params.inputProps,
},
}}
/>
)}
/> |
I agree with @siriwatknp; About #43606, we should update Autocomplete to use <Autocomplete
options={top100Films}
renderInput={(params) => (
<TextField
{...params}
slotProps={{
input: {
className: 'custom-input-wrapper',
…params.slotProps.input,
},
htmlInput: {
id: 'my-id',
…params.slotProps.htmlInput,
},
}}
/>
)}
/> I'm closing this one and following up on #43606. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. |
Steps to reproduce
Link to live example: (required) https://stackblitz.com/edit/react-osybga?file=Demo.tsx
Steps:
inputProps
and id is passed throughslotProps.htmlInput
inputProps
didn't get attached and onlyid
got attachedinputProps
is deprecated not removed, as a user i would expect old behavior would work as is, irrespective of whetherslotProps
is passed or not.FYI: This PR actually solved this issue, we can consider merging it if we think this issue is a bug.
How to test changes changes are working in #43606
Current behavior
props passed in
inputProps
not getting attached ifslotProps.htmlInput
is passedExpected behavior
props passed in
inputProps
should get attchedContext
No response
Your environment
npx @mui/envinfo
Search keywords: TextField
The text was updated successfully, but these errors were encountered: