Reputation: 6280
I have tried various styling methods but the Dropdown menu does not seem to decrease in width. It is fixed at 84px
no matter how much I try to decrease. It however behaves correctly if I set the width to more than 100px
. I even tried to set minWidth
on the menuStyle
which seem to getting applied to the respective div
.
Should I consider something else or is there a workaround to do this? Any leads would be greatly helpful. I am using material-ui
version 0.15.4
import IconMenu from 'material-ui/IconMenu';
import MenuItem from 'material-ui/MenuItem';
import IconButton from 'material-ui/IconButton';
import Divider from 'material-ui/Divider';
import Download from 'material-ui/svg-icons/file/file-download';
import ArrowDropRight from 'material-ui/svg-icons/navigation-arrow-drop-right';
import MoreVertIcon from 'material-ui/svg-icons/navigation/more-vert';
class Example extends React.Component {
render() {
return (
<IconMenu
iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
anchorOrigin={{horizontal: 'left', vertical: 'top'}}
targetOrigin={{horizontal: 'left', vertical: 'top'}}
menuStyle={{width: "25px", minWidth: "25px"}}
>
<MenuItem key="1" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="2" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="3" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="4" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="5" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="6" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="7" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
<MenuItem key="8" style={{height: "5px", marginBottom: "20px"}} leftIcon={<Download />} />
</IconMenu>
)
}
}
Upvotes: 0
Views: 761
Reputation: 58573
Just add this lines to css
div[role=presentation] {
width: 50px !important;
}
Upvotes: 1