Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selectfield dropdown position #5634

Closed
Muneem opened this issue Nov 23, 2016 · 14 comments
Closed

Selectfield dropdown position #5634

Muneem opened this issue Nov 23, 2016 · 14 comments
Labels
component: select This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@Muneem
Copy link

Muneem commented Nov 23, 2016

How to set position of dropdown of selectfield. I want to show dropdown below selectfield i dont want it should come above it

@m2mathew
Copy link
Member

m2mathew commented Dec 6, 2016

@Muneem It looks like you could use the menuStyle prop as discussed here near the bottom of the page.

I have also used the Popover component as an alternative to the DropDownMenu. It allows easier control over the visual position of the Popover menu.

@mbrookes mbrookes added component: select This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement labels Jan 17, 2017
@sravivenki
Copy link

i want drop down only in select field..how can we control vertical position of drop down.right now menu overlapping and hiding the select field label.

@ddawkins7
Copy link

ddawkins7 commented Jan 11, 2018

+1 has this been answered?

@JeremyGrieshop
Copy link

JeremyGrieshop commented May 30, 2018

Just wanted to leave this here, in case someone else has the same question in 1.0:

<Select
  MenuProps={{
    getContentAnchorEl: null,
    anchorOrigin: {
      vertical: "bottom",
      horizontal: "left",
    }
  }}
>

</Select>

@oliver-welch
Copy link

@cobbs-totem you the real mvp

@quocvan1311
Copy link

@JeremyGrieshop you are the champ :D

@ryanvazquez
Copy link

ryanvazquez commented Apr 20, 2020

@JeremyGrieshop Dropping in from the future to to thank you

@kipperlhp
Copy link

@JeremyGrieshop You make my day

@Tcormons
Copy link

Yeah this is awesome!

@pzanwar03
Copy link

<Select
          defaultValue=""
          MenuProps={{
            anchorOrigin: {
              vertical: "bottom",
              horizontal: "left"
            },
            transformOrigin: {
              vertical: "top",
              horizontal: "left"
            },
            getContentAnchorEl: null
          }}
        >
          <MenuItem value={1}>Option 1</MenuItem>
          <MenuItem value={2}>Option 2</MenuItem>
</Select>

@krislao
Copy link

krislao commented Jul 9, 2020

@JeremyGrieshop 2 years after, thank you! 💯

@oliviertassinari oliviertassinari added duplicate This issue or pull request already exists and removed support: question Community support but can be turned into an improvement labels Jul 9, 2020
@sudarshan-mane
Copy link

sudarshan-mane commented Jul 12, 2020

@JeremyGrieshop please help me, I did as you said but my position after click is viewport bottom and viewport left. Please help. I am using Material UI Menu

<Menu
     anchorBuyer={anchorBuyer}
     anchorOrigin={{ vertical: "top", horizontal: "left" }}
     id={menuIdBuyer}
     keepMounted
     transformOrigin={{ vertical: "top", horizontal: "left" }}
     open={isMenuBuyerOpen}
     onClose={handleMenuCloseBuyer}
   >

@nicolauscg
Copy link

had an issue that label becomes missing when select is clicked after successfully changing dropdown position from answers above, turns out the default styling changes input label color to white on focus which is my background color. To fix it, simply override the styling <InputLabel classes={{focused: classes.X}}> where class X contains color: "initial". mui v4.11.0

@tunino91
Copy link

Hello All,
Currently not having any success (no change in the MenuItems' position) with @JeremyGrieshop and @pzanwar03 methods. Do you think this might be due to the fact that my <Select> is wrapped around the <FormControl> ? Thanks for any advise in advance.

<FormControl className={classes.textField}>
    <InputLabel id="demo-simple-select-outlined-label">Type</InputLabel>
    <Select
        MenuProps={{
            anchorOrigin: {
                vertical: "bottom",
                horizontal: "left"
            },
            transformOrigin: {
                vertical: "top",
                horizontal: "left"
            },
            getContentAnchorEl: null
        }}
       labelId="demo-simple-select-outlined-label"
       id="demo-simple-select-outlined"
       value={props.x}
       onChange={props.handleChange}
       label="x"
       name="x">  
           <MenuItem value={'1'}>1</MenuItem>
           <MenuItem value={'2'}>2</MenuItem>
    </Select>
</FormControl>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests