[AutoComplete]
Description
Can not set width of dropdown I want an autocomplete field where the searchfield should be smaller than the contents of the dropdown.
Images & references
You can set a custom width through listStyle:
<AutoComplete
listStyle={{
width: 500,
}}
hintText="Type anything"
dataSource={this.state.dataSource}
onUpdateInput={this.handleUpdateInput}
/>
Ah thanx, I will give it a try. It is very hard to find this out at the moment. I really hope the new styling mechanism coming in 0.16 is making this better (but more importantly that it improves the performance because that should be priority 1 for this project in my opinion).
@hmeerlo Were you able to resolve the issue with the solution posted above?
Yes partially. You cannot set fullWidth to true because then it won't work. That's too bad because I wanted my searchField to be fullWidth of the enclosing div and the dropdown wider than that.
You can set a custom width through
listStyle:<AutoComplete listStyle={{ width: 500, }} hintText="Type anything" dataSource={this.state.dataSource} onUpdateInput={this.handleUpdateInput} />
@oliviertassinari is that listStyle props still exist on the autoComplet component?
@oliviertassinari what is the alternative of it?
@oliviertassinari what is the alternative of it?
This is the alternative:
<AutoComplete
ListboxProps={{ style: { maxHeight: 200, overflow: 'auto' } }}
...
/>