我不确定如何将颜色从默认的蓝色更改为其他颜色。示例代码在下面的codeandbox链接中。我尝试更改root的样式,但没有成功。
答案 0 :(得分:2)
react-select
的2.1.0版本中添加了覆盖主题的选项。
以下是其工作方式示例:
<Select
defaultValue={flavourOptions[0]}
label="Single select"
options={flavourOptions}
theme={(theme) => ({
...theme,
borderRadius: 0,
colors: {
...theme.colors,
text: 'orangered',
primary25: 'hotpink',
primary: 'black',
},
})}
/>