How to add menu items to Material UI cards
P粉662802882
2023-08-30 10:24:08
<p>I have the following example:</p>
<p>https://codesandbox.io/s/material-ui-card-styling-example-lcup6?fontsize=14</p>
<p>I just wanted to add some menus, such as edit, delete, to the three-dot menu link, but with no success. Tried adding menu items etc. to the <code>IconButton</code> and <code>MoreVertIcon</code> sections but nothing changed. </p>
<p>So, what should I do? </p>
In the example you provided, the menu link does not have any
onClick
action. It sounds like you need aMenu
element to appear when the menu button is clicked. Please see Menu component in the MUI documentation.As an example, I forked your example and added a menu.