How can i add style to the root of React's CreatableSelect?

Viewed 480
1 Answers

If I understand you correctly, the root element has no styles (expect position: relative; box-sizing: border-box;) so I'm not sure what styles you want to change but you can set its styles by targeting its className.

e.g

<Select
  className="container"
/>
.container {
  background: red;
}

https://codesandbox.io/s/hungry-hawking-2prwd?file=/example.js

A bit explanation: react-select doesn't offer a prop for the root element because there is no need to. The whole reason of the styles prop is because the inner classes are scoped (For example). This is not the case of the root element.

Related