如何覆盖 material UI 组件中的自动完成选定选项

How can I override autocomplete selected option in material UI components

如何在自动完成 material UI 中覆盖所选选项 Css,如何在主题的帮助下完成

您可以通过自定义点定位选定的选项css。

...
const useStyles = makeStyles((theme) => ({
  option: {
    background: "white",
    "&:hover": {
      background: "red"
    },
    '&[aria-selected="true"]': {
      background: "blue"
    }
  }
}));

<Autocomplete
  ...
  classes={{
    option: classes.root
  }}
/>

现场演示

<Autocomplete
  ...
  classes={{
    option: classes.root --> option
  }}
/>