The new v2 react-select control is great, but by default is too large. Is there a (preferably) simple way to reduce the height to the same as a standard select control (using Bootstrap v3)?
Read the react-select docs HERE. React-Select v2 uses emotion CSS-in-JS so the new way to control style over the select components and sub-components is by passing a style object to the styles prop. You can also set a className to style with an external stylesheet.
To style react-select drop down options, we can create an object with the styles we want to apply and set that as the value of the styles prop. We create the colourStyles object with the control method that return an object with the styles. And we have the option method that returns the styles for the options.
Try passing in a value for the maxMenuHeight prop:
<Select
maxMenuHeight={190}
/>
see documentation
The answer below was given when react-select v2 was in beta, much has changed since then.
React-Select v2 uses emotion CSS-in-JS so the new way to control style over the select components and sub-components is by passing a style object to the styles
prop. You can also set a className to style with an external stylesheet.
const customControlStyles = base => ({
height: 20,
minHeight: 20
});
<Select ... styles={{control: customControlStyles}} ... />
<Select ... className="myClassName" ... />
.myClassName__control {
height: 20px;
min-height: 20px;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With