question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MenuItems are not fullWidth if TextField is fullWidth

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

If a TextField is set to fullWidth and used as a Select, the MenuItems should be as wide as the input (and Menu).

Current Behavior

The Menu is the same width as the TextField, but the MenuItems are not the correct size.

image_1024

Steps to Reproduce (for bugs)

<TextField fullWidth select  label="Days and Stuff">
    <MenuItem value={0}>Today</MenuItem>
    <MenuItem value={1}>24 Hours</MenuItem>
    <MenuItem value={7}>7 Days</MenuItem>
    <MenuItem value={15'}>15 Days</MenuItem>
    <MenuItem value={30}>30 Days</MenuItem>
</TextField>

Context

This just looks wonky - its not critical but people think our app is broken. In the meantime, I’ve used the native prop to skirt around the issue.

Your Environment

Tech Version
Material-UI beta 33
React 15.x
browser Chrome / FF
etc

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
benmartecommented, Feb 23, 2018

Another alternative is to use an override on the List component, i.e:

MuiList: {
      root: {
        width: '100%',
      },
    },
1reaction
theY4Kmancommented, Feb 21, 2018

This can be used as a workaround:

<TextField fullWidth select SelectProps={{ MenuProps: { MenuListProps: { style: { width: '100%' } } } }}>
Read more comments on GitHub >

github_iconTop Results From Across the Web

MenuItems are not fullWidth if TextField is fullWidth #10395
If a TextField is set to fullWidth and used as a Select, the MenuItems should be as wide as the input (and Menu)....
Read more >
Material-UI set <Select> to be as wide as widest <MenuItem>?
Have you tried adding fullWidth property in the textfield component? try to specify a container of your desired width and the input will ......
Read more >
TextField API - Material UI - MUI
Name Type Default autoComplete string autoFocus bool false classes object
Read more >
How To Create Full Width Buttons - W3Schools
Learn how to style block buttons (full-width) with CSS. ... To create a full-width button, add a width of 100% and make it...
Read more >
How to make a full width page | Shogun Support Center
Firstly, you will want to drag a Container Element onto your page. From the right-hand menu of the editor, you will notice that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found