When using react-select
it is not auto sizing by option value, but using width:100%
as you can see in picture:
Options are short:
getOptions() {
return [
{ value: 'AND', label: 'AND' },
{ value: 'OR', label: 'OR' }
]
}
And code which produces it:
<Select
options={this.getOptions()}
value={value}
autosize={true}
clearable={false}
simpleValue
/>
Is there any way to make react-select
to show these values with auto sizing, so select box would be the same as option length, and I could, for example, center this select box in <div>
?
Updated 14.11.2017 Full example can be seen in this jsFiddle
Inline styles did not work for me. I just wrapped the Select component in a div and gave the div the width I wanted.
<div style={{width: '300px'}}>
<Select
menuPlacement="auto"
menuPosition="fixed"
etc, etc..
/>
</div>