PineUiPhoenix.Components.ContextMenu (Pine UI v0.2.1)

Copy Markdown View Source

A menu opened by right-clicking a region.

A port of the Pines context menu.

<.context_menu>
  <:trigger>
    <div class="grid h-40 place-items-center rounded-md border border-dashed">
      Right-click here
    </div>
  </:trigger>
  <:item on_click="copy">Copy</:item>
  <:item on_click="delete" variant="danger">Delete</:item>
</.context_menu>

Summary

Overlays

Renders a right-click context menu.

Overlays

context_menu(assigns)

Renders a right-click context menu.

Positioning

The menu is placed at the pointer, then nudged back inside the viewport if it would overflow the right or bottom edge — otherwise right-clicking near a corner opens a menu that is partly offscreen and unreachable.

Attributes

  • id (:string) - Defaults to nil.
  • width (:string) - Defaults to "w-56".
  • class (:string) - Defaults to nil.
  • menu_class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • trigger (required) - The region that responds to right-click.
  • item - Accepts attributes:
    • navigate (:string)
    • href (:string)
    • on_click (:any)
    • variant (:string) - Must be one of "default", or "danger".
    • disabled (:boolean)
    • divider (:boolean)
    • shortcut (:string) - Keyboard hint shown right-aligned, e.g. \"⌘C\".