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>
<.menu label="Actions">
  <:item>
    <.menu_item on_click={%JS{ops: [["dispatch", %{event: "myapp:copy"}]]}}>
      Copy
    </.menu_item>
  </:item>
</.menu>