Material UI InputAdornment not showing anything

Viewed 1118

I'm using MUI for the first time on a project. Trying to get InputAdornment to show a magnifying glass svg icon inside a TextInput. I'm following the example here: https://mui.com/components/text-fields/

Regardless of the content of the adornment, I cannot get anything to show up in the UI. In the inspector, the input adornment attribute looks like this endadornment="[object Object]"

My code is like this:

<TextField
    defaultValue={''}
    inputProps={{
        placeholder: 'Search',
        endAdornment: <InputAdornment position="end">any</InputAdornment>
    }}
    onChange={handleChange}
/>
1 Answers

Answered by cris_b in a comment. Turns out there is an InputProps prop and an inputProps prop on TextField.

The difference between the two according to the MUI text-field API documentation:

inputProps: object
Attributes applied to the input element.

InputProps: object
Props applied to the Input element. It will be a FilledInput, OutlinedInput or Input component depending on the variant prop value.

Related