Menu Item

Renders a button that acts as a menu item within a menu/1 or menu_bar/1.

Read more Read less

A menu item is meant to be used to trigger an action. For a button that toggles the visibility of a menu, use menu_button/1.

Usage

<.menu label="Actions">
  <:item>
    <.menu_item on_click={JS.dispatch("myapp:copy")}>
      Copy
    </.menu_item>
  </:item>
  <:item>
    <.menu_item on_click={JS.dispatch("myapp:paste")}>
      Paste
    </.menu_item>
  </:item>
</.menu>
Attribute Type Documentation Default Value
class :any Any additional classes to be added. Variations of the component should be expressed via modifier attributes, and it is preferable to use styles on the parent container to arrange components on the page, but if you have to, you can use this attribute to pass additional utility classes to the component. The value can be a string or a list of strings. []
Required on_click * %JS{}
rest :global
Required inner_block * :slot
Copy