5

How to show dropdown on button click using material ui?

Currently, I'm able to do so but extra select field is getting populated which is not required. I don't want to hide select field with css.

Also, How can I change width, height, position and other properties of generated popover using material ui? codesandbox url: https://codesandbox.io/s/du8mr

current implementation

popover

1

1 Answer 1

3

You can use Menu component instead of a Select component.

You can change the Menu props using MenuProps which receives all Popover props.

From Menu documentation:

Any other props supplied will be provided to the root element (Popover).

Sign up to request clarification or add additional context in comments.

4 Comments

How can I change width, height, position and other properties of generated popover using material ui?
See this example for Popover. If you do not want the Select, you can use a Menu which uses Popover component under the hood and you can pass all the props to Menu. You can use CSS to set height and width for Menu component.
How can I pass "Popover" props via "Menu"?
You can pass all Popover props directly to Menu component. See the quotation above. Meaning you can do <Menu anchorOrigin={{horizontal: 'center', vertical: 'vertical'}} />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.