2
<Autocomplete
  {...defaultProps}
  id="disable-close-on-select"
  disableCloseOnSelect
  renderInput={(params) => (
    <TextField {...params} label="disableCloseOnSelect" variant="standard" />
  )}
/>

This is the sandbox link.

endAdornment arrow taking too much space with the last character in Material-UI Autocomplete.

NearHuscarl
  • 66,950
  • 18
  • 261
  • 230

1 Answers1

0

You can update the padding-right by targeting the element with the class MuiAutocomplete-inputRoot. You also need to use the double ampersand && to increase the CSS specificity so the property can be overridden:

import Autocomplete, { autocompleteClasses } from "@mui/material/Autocomplete";

export default function ComboBox() {
  return (
    <Autocomplete
      options={top100Films}
      inputValue="looooooooooooooooooooooooooooooong text"
      sx={{
        width: 300,
        [`&& .${autocompleteClasses.inputRoot}`]: {
          paddingRight: 2, // change this value to your preference
        }
      }}
      renderInput={(params) => <TextField {...params} label="Movie" />}
    />
  );
}

Live Demo

Codesandbox Demo

NearHuscarl
  • 66,950
  • 18
  • 261
  • 230