Open brandong954 opened 1 month ago
looks like this is related to https://github.com/mui/material-ui/issues/43573
I've tried running your code from #43606 sandbox, looks like it is working.
I was able to get things working by using styleOverrides
instead of defaultProps
; however, it seems like both should be valid.
I had the same issue recently just that I didn't provide slotProps
through the Theme but directly on the <TextField>
element, and the autocomplete missbehaved and also crashed, with an error like Autocomplete expects input to be present
.
@mj12albert
My conclusion is that the problem occurs because the params
passed to renderInput
contain inputProps
and InputProps
(which are actually obsolete) and if you also provide slotProps
these conflict each other. (also provided InputLabelProps needs to be considered when fixing).
Steps to reproduce
Steps:
Autocomplete
with aThemeProvider
with the following theme defined:Current behavior
No dropdown/popper is displayed with the provided options. No runtime errors are incurred either.
Expected behavior
Able to style
Autocomplete
TextField
input at the theme level without negatively affecting its popper/dropdown from displaying.Context
I want the
Autocomplete
TextField
input to be styled like every otherTextField
input within my application by using a givenThemeProvider
to do so.A similar issue was also encountered with
DatePicker
.Your environment
``` System: OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm) Binaries: Node: 22.9.0 - /usr/local/bin/node npm: 10.8.3 - /usr/local/bin/npm pnpm: Not Found Browsers: Microsoft Edge Version 129.0.2792.52 (Official build) (arm64) Google Chrome Version 128.0.6613.139 (Official Build) (arm64) npmPackages: @emotion/react: ^11.13.0 => 11.13.3 @emotion/styled: ^11.13.0 => 11.13.0 @mui/core-downloads-tracker: 6.1.1 @mui/icons-material: ^6.1.1 => 6.1.1 @mui/material: ^6.1.1 => 6.1.1 @mui/private-theming: 6.1.1 @mui/styled-engine: 6.1.1 @mui/system: 6.1.1 @mui/types: 7.2.17 @mui/utils: 6.1.1 @mui/x-date-pickers: ^7.18.0 => 7.18.0 @mui/x-internals: 7.18.0 @types/react: 18.3.8 react: ^18.3.1 => 18.3.1 react-dom: ^18.3.1 => 18.3.1 ```npx @mui/envinfo
Search keywords: Autocomplete popper ThemeProvider theme input slotProps