简体   繁体   English

点击后移除 MUI Select 组件的边框 - React JS

[英]Remove MUI Select Component's border after you click on it - React JS

I want to remove the border on Select from MUI after I click on it and I can't find the proper CSS to overwrite I managed to remove the default one, but not the blue one after I click the component, as shown in this sandbox ( https://codesandbox.io/s/autumn-bash-zgy4km?file=/demo.tsx )我想在单击它后从 MUI 中删除 Select 上的边框,但我找不到合适的 CSS 来覆盖我设法删除了默认的边框,但在单击组件后没有删除蓝色的边框,如此沙箱中所示( https://codesandbox.io/s/autumn-bash-zgy4km?file=/demo.tsx

Image with the blue border I want to remove - appears after I click on Select我要删除的带有蓝色边框的图像 - 单击 Select 后出现

You can remove it like this你可以像这样删除它

<Select
          labelId="demo-simple-select-label"
          id="demo-simple-select"
          value={age}
          label="Age"
          onChange={handleChange}
          sx={{
            borderRadius: 0,
            "& .MuiOutlinedInput-notchedOutline": {
              border: 0
            },
            "&.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline": {
              border: "none"
            }
          }}
        >

Here is the working codesandbox这是工作代码和

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM