Unable to change react-select selected value color when menu is clicked #5174
-
I am using react-select to select and search from a list. I need to change the text color of the selected text (that is visible in the search box) to gray when the user clicks on the search box and intends to search for a new option while letting it remain black when the user clicks out of the search box/has selected a new option. I can change the color of the text by modifying the style for singleValue in the styles prop. But cannot change the color when the search menu is selected. Tried some other options too but the text color does not change when the search menu is in the selected state.
Any suggestions what I am doing wrong here? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I am also having this issue. I found the logic for the color change here, and it is tied to the theme. Even after setting the |
Beta Was this translation helpful? Give feedback.
-
@adeeb1 I created this small function and called it with
I just set the color to gray but of course you can do something more fancy with this as well. |
Beta Was this translation helpful? Give feedback.
@adeeb1 I created this small function and called it with
styles={customStyles()}
in my Select component. I checked with React Dev Tools and only thecontrol
component has the propertymenuIsOpen
which tracks whenever a user clicks/taps on the search bar.I just set the color to gray but of co…