![](/img/trans.png)
[英]Remove MUI Select Component's border after you click on it - React JS
[英]How to remove the border of the MUI select component?
我想自定義MUI Select
組件。 基本上我只想刪除邊框或更確切地說是輪廓。 我試圖覆蓋styles,嘗試使用NativeSelect
並嘗試將自定義的InputBase
與Select
用作inputComponent ,但這些都不起作用。 任何幫助將非常感激。
邊框應用於OutlinedInput
組件的標簽。 編輯OutlinedInput
組件的 css 規則notchedOutline
以移除邊框。 https://mui.com/api/outlined-input/#css
MUI 在Select
組件中公開了disableUnderline
屬性。 只需將其設置為true
我遵循@Bar的回答:在我的情況下,我還必須重置應用於Select
的box-shadow
。
對於材料 v5,
<Select sx={{ boxShadow: 'none', '.MuiOutlinedInput-notchedOutline': { border: 0 } }}>
對我有用的是使用
disableUnderline
刪除選擇器下方的行variant="standard"
去除邊框,無論選擇器是否聚焦。 設置'.MuiOutlinedInput-notchedOutline': { border: 0 }
只會在未聚焦時移除選擇器的邊框。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.