react-select

React Select: How do I force the dropdown to display in order to work on styling?


I need to work on the styling of the React Select dropdown options. The way that I normally do CSS styling work is to use use the Developer Tools in Chrome, point to an element on the page and start adjusting the CSS properties in the Styles tab and see how the elements change.

The trouble with styling React Select's dropdown options is that the options are only visible when the element has focus. And the moment I turn on Developer Tools, the element loses focus and the dropdown disappears!

Is there a way for me to force React Select to show the dropdown options, without the element having focus?


Solution

  • Install React Developer Tools so you can force the Select component's isOpen state to true. Then the dropdown menu will stay open when you fiddle in Chrome's developer tools.

    React tab in Chrome's developer tools

    Source