Material-ui: AutoComplete fontSize is not working

Created on 2 Jan 2017  路  6Comments  路  Source: mui-org/material-ui

fontSize is not applying in AutoComplete.
Sample code -
<AutoComplete menuStyle = {{fontSize:14}} listStyle={{fontSize:14}} .. .. />

Versions

  • Material-UI: 0.16.6
  • React: 15.3.1
  • Browser: Chrome
Autocomplete

Most helpful comment

I got this rendering as I wanted using the following but would be great if a simpler fontSize property was made available to the menu so we don't have to map and use a MenuItem which feels like overkill for a simple use case such as this:

...
dataSource={results.map((val) => { return {
  text: val.description,
  value: (
    <MenuItem
      primaryText={val.description}
      style={{ fontSize: 15, width: 300, textOverflow: 'ellipsis', overflow: 'hidden' }}
    />
  ) }
})}
...

NB The ellipsis property does not seem to work as expected in this example

All 6 comments

Facing the same issue.

@ashutoshjha1409 me too facing the same issue

Did this work in a previous version?

Hi all, I am facing the same problem, the following works as expected and allows me to set the size of the hint and input text:

hintStyle={{ fontSize: 15 }}
inputStyle={{ fontSize: 15 }}

...however setting the same on the list and menu does not appear to have any effect...

listStyle={{ fontSize: 15 }}
menuStyle={{ fontSize: 15 }}

It would be great to be able to provide consistent sizing to the various parts of the autocomplete component.

I got this rendering as I wanted using the following but would be great if a simpler fontSize property was made available to the menu so we don't have to map and use a MenuItem which feels like overkill for a simple use case such as this:

...
dataSource={results.map((val) => { return {
  text: val.description,
  value: (
    <MenuItem
      primaryText={val.description}
      style={{ fontSize: 15, width: 300, textOverflow: 'ellipsis', overflow: 'hidden' }}
    />
  ) }
})}
...

NB The ellipsis property does not seem to work as expected in this example

Same issue. Can't set font size on autocomplete.

IMO, we should never set font-sizes explicitly in MUI. They should be inherited from the theme / body tag. Why we do this confuses me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

newoga picture newoga  路  3Comments

ryanflorence picture ryanflorence  路  3Comments

revskill10 picture revskill10  路  3Comments

ghost picture ghost  路  3Comments

rbozan picture rbozan  路  3Comments