[Joy][TextField] Invalid componentProps mapping #34217
Labels
component: text field
This is the name of the generic UI component, not the React module!
design: joy
This is about Joy Design, please involve a visual or UX designer in the process
Duplicates
Latest version
Current behavior 😯
Correct me if I am wrong, is it the expected behaviour that when trying to set the maxlength attribute on the textfield using
componentProps
prop, the attribute gets passed to root element instead of the input slot?This renders to:
Notice how the maxlength attribute is passed to the root element instead of the native input element.
Workaround
Expected behavior 🤔
Input component props should get passed to the native input element. Adding
inputProps
prop to the TextField component might help with this.Steps to reproduce 🕹
CodeSandbox: https://codesandbox.io/s/nervous-water-k0ktu4?file=/src/App.tsx
Context 🔦
Trying to set native input element attributes on the TextField component.
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: