Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-Select Scrollbar Styling

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;
}
like image 224
Penny Pang Avatar asked Jul 14 '26 04:07

Penny Pang


2 Answers

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} ... />
like image 152
Arpit Avatar answered Jul 18 '26 01:07

Arpit


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;
}
like image 45
Hai Pham Avatar answered Jul 18 '26 01:07

Hai Pham