简体   繁体   English

如何更改 react-select Select 元素的边框?

[英]How can i change the border of a react-select Select element?

I need to change the color of the border when the dark mode is active on my application, but i can't change the border color because it doesn't change with inline styling.当我的应用程序上的暗模式处于活动状态时,我需要更改边框的颜色,但我无法更改边框颜色,因为它不会随内联样式而改变。 This is the code i have.这是我的代码。

<Select 
    onChange={(e) => filtrarRegiao(e.value)} 
    placeholder="Filter by region"
    className={darkModeOn ? 'dark-lista' : 'lista'}
    style={{  }}
    styles={customStyles}
    components={{ ValueContainer, Placeholder, IndicatorsContainer, Group }}
    options={regions} 
/>

Please checkout this codesandbox link.请查看此代码框链接。

https://codesandbox.io/s/heuristic-shockley-02c9z?file=/src/App.js https://codesandbox.io/s/heuristic-shockley-02c9z?file=/src/App.js

After reading the official documentation, you need to pass object with阅读官方文档后,需要通过 object 与

{control:()=>{ return { border: "1px solid black" } }}

to styles to use customize styles.到 styles 使用自定义 styles。

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

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