I am trying to change the style of scrollbar from react-select and customise it. Anyone have any idea how?
This is the code in css that I want to style it to
/* Scroll Bar */
::-webkit-scrollbar {
width: 4px;
height: 0px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
In react-select v4+, we use like this
const styles = {
menuList: (base) => ({
...base,
"::-webkit-scrollbar": {
width: "4px",
height: "0px",
},
"::-webkit-scrollbar-track": {
background: "#f1f1f1"
},
"::-webkit-scrollbar-thumb": {
background: "#888"
},
"::-webkit-scrollbar-thumb:hover": {
background: "#555"
}
});
}
return <Select styles={styles} ... />
Try overriding react-select css:
/* Scroll Bar */
select__menu-list::-webkit-scrollbar {
width: 4px;
height: 0px;
}
select__menu-list::-webkit-scrollbar-track {
background: #f1f1f1;
}
select__menu-list::-webkit-scrollbar-thumb {
background: #888;
}
select__menu-list::-webkit-scrollbar-thumb:hover {
background: #555;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With