Material-ui: [AutoComplete] Impossible to specify custom width

Created on 14 Apr 2016  路  10Comments  路  Source: mui-org/material-ui

MUI 0.15.0-alpha.2
React 15.0.1
Chrome 49

It is currently not possible to change the width of AutoComplete. It's hard-coded to 256px wide. Maybe another prop such as innerStyle could address this?

Autocomplete question

Most helpful comment

use style into "renderInput"
Ex: ' renderInput={params => } '

All 10 comments

@ffxsam - set fullWidth and put it in a container of the desired width.

Please use the appropriate forum for questions before opening issues. :+1:

Ok.. I'll admit, that was dumb on my part. :)

NP. You can also use width in the style and menuStyle props.

@ffxsam - 'textFieldStyle' property of Autocomplete solves the problem

@abdulsaboorahmed it doesn't actually, if you set textFieldStyle to say 200 pixels wide, the outer container of the AutoComplete is still 256 pixels wide.

This isn't a huge deal but it was causing me some grief when the user trys to "unfocus" / "blur" the field by clicking right next to it...

Setting the width with the root "style" prop does seem to be working now at least as of v0.16.7

use fullWidth

No, it's not working! I tried all the hacks, there must be a solution and not workaround!

I had the same issue here, using an AutoComplete within a drawer, and I wanted the menu displaying over with a wider width. The problem seems to be in the Popover being restricted to 256px, and 'fullWidth' option didn't help.

I solved the problem using :
popoverProps={{ style: { width: 'auto'} }}

add this:
style={{ width: '100%' }}
/>

use style into "renderInput"
Ex: ' renderInput={params => } '

Was this page helpful?
0 / 5 - 0 ratings

Related issues

revskill10 picture revskill10  路  3Comments

TimoRuetten picture TimoRuetten  路  3Comments

newoga picture newoga  路  3Comments

chris-hinds picture chris-hinds  路  3Comments

mb-copart picture mb-copart  路  3Comments