How to change zIndex in react-select drowpdown

Khushboo picture Khushboo · Apr 24, 2019 · Viewed 10.4k times · Source

I am using the react-select library to create autocomplete drop-down. I have used 2 drop-down parallel if 2nd has some data & I open first one then the zIndex problem comes. see the imageenter image description here

Answer

Vicente picture Vicente · Apr 24, 2019

Try this hacky way of setting zIndex, and let me know if it worked :)

<Select
  styles={{
    // Fixes the overlapping problem of the component
    menu: provided => ({ ...provided, zIndex: 9999 })
  }}
  value={selectedOption}
  onChange={evt => onSelectChange(evt, index)}
  options={options}
/>