英文:
The className in react-select doesent apply
问题
I just started using react-select and when I try to add my styles using scss they dont apply, I know that there is an option for styles where you set option styles as well as control but I want a cleaner way using scss
Here is what I want:
Here is what I get after applying className:
Is there a way to disable the preset styles so I can make my own or how can I modify it so it takes my real styles here is my css:
.shippingCountryDropdownElement {
border: none;
height: 42px;
background-color: red;
color: gray;
outline: none;
font-weight: 400;
font-size: 14px;
line-height: 21px;
cursor: pointer;
&:focus {
box-shadow: none;
}
}
And if not is there a better solution for a dropdown than this library, any help would be great. Thanks in advance
英文:
I just started using react-select and when I try to add my styles using scss they dont apply, I know that there is option for styles where you set option styles as well as control but I want a cleaner way using scss
Here is what I want:
Here is what I get after applying className:
Is there a way to disable the preset styles so I can make my own or how can I modify it so it takes my real styles here is my css:
.shippingCountryDropdownElement {
border: none;
height: 42px;
background-color: red;
color: gray;
outline: none;
font-weight: 400;
font-size: 14px;
line-height: 21px;
cursor: pointer;
&:focus {
box-shadow: none;
}
}
And if not is there a better solution for a dropdown than this library, any help would be great. Thanks in advance
答案1
得分: 1
对于 react-select
组件,您可以像这样修改其默认样式:
// 隐藏指示线
.shippingCountryDropdownElement .select__indicator-separator {
display: none;
}
// 隐藏字段周围的边框
.shippingCountryDropdownElement .select__control {
border: 0px;
}
您可以在这里获取更多详细信息。
英文:
For the react-select
component, you will be able to modify it's default style like this:
// To Hide Indicator Line
.shippingCountryDropdownElement .select__indicator-separator {
display: none;
}
// To Hide Border Around Field
.shippingCountryDropdownElement .select__control {
border: 0px;
}
You can refer here for more details on this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论