material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

There is no way to affect the stying of the menu in a SelectField

Open gausie opened this issue 10 years ago • 8 comments

Description

There is no way (via class or inline styling) to affect the styling of the popover menu in a SelectField.

menuStyle, despite looking like it might be the correct prop actually affects the underlying DropDownMenu control and not the dropdown menu itself.

Not sure how you would want this implemented so awaiting advice before making a PR.

Images & references

https://github.com/callemall/material-ui/issues/4858

gausie avatar Sep 29 '16 10:09 gausie

Just stumbled upon same issue, trying to style the menu width....

In my humble opinion for a PR, i would play with this line in SelectField.js, renaming style= with menuStyle= ?

Sharlaan avatar Nov 05 '16 17:11 Sharlaan

@Sharlaan: That's exactly it!

Please send a PR with that change, we would be glad to review it.

cc @oliviertassinari.

lucasbento avatar Nov 06 '16 01:11 lucasbento

For reference, we have #5091, #5389, #3388 and #5166 related to the overriding of the style properties. It would be good to find a coherent solution to all of those.

oliviertassinari avatar Nov 06 '16 16:11 oliviertassinari

Is anyone still working on this? If not I'd like to give it a try

danep93 avatar Jan 16 '17 21:01 danep93

This was fixed by #5389. 👍

mbrookes avatar Jan 16 '17 21:01 mbrookes

Hi, I'm new to this so could easily be wrong, but I think the intent of @gausie (correct me if I'm wrong @gausie) was to be able to control the style of the whole popover, not just the elements within it. menuStyle affects the select item itself (not the popover), selectedMenuStyle and menuItemStyle affect the entries in the popover but I think that @gausie 's request was to be able to affect the style of their ancestor (which I can only identify to you by means of its inline styles position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 2000;) We too have the problem that we want to override that fixed z-index of 2000 in certain circumstances to make it higher still. If that div were to have an id or a class or if we could set inline styles for it, I think that would satisfy @gausie 's request and mine too. Is it possible to reopen this on that basis please @mbrookes ? Thanks in advance.

Bagnall avatar Jul 06 '17 09:07 Bagnall

@Bagnall I believe you can override the z-index in the theme: http://www.material-ui.com/#/customization/themes

mbrookes avatar Jul 06 '17 12:07 mbrookes

Hi @mbrookes thanks, that appears to do the trick. I'm now setting z-index for layer based on this: https://github.com/callemall/material-ui/blob/master/src/styles/zIndex.js

Bagnall avatar Jul 06 '17 13:07 Bagnall