WlMenu

Menu from a WlMenuItem list with groups and separators. Popup mode is controlled through toggle/show/hide.
Components / Actions v0.1.0

Basic example

Choose an action · View: list · false

Full example
<div class="wl-stack" data-space="md">
  <WlMenu :items="items" aria-label="Material actions"  />
  <p role="status" class="wl-text-small">{{ selection }} · {{ "View" }}: {{ view }} · {{ compact }}</p>
</div>

Static and popup menus

Heading, separator, icons, shortcut label, disabled and danger; commands produce a local result.

No command selected yet.

↑/↓, Home and End move focus. Escape closes the popup. Shortcut displays the key combination; the application adds its handler.

Full example
<script setup lang="ts">
import { WlButton, WlMenu, type WlMenuExpose, type WlMenuItem } from "legato-ui";
import { ref } from "vue";
const popup = ref<WlMenuExpose | null>(null);
const message = ref("No command selected yet.");
const items: WlMenuItem[] = [
  { header: "Material" },
  { key: "edit", label: "Edit", icon: "edit", shortcut: "Ctrl+E", command: () => message.value = "Editing opened." },
  { key: "copy", label: "Copy link", icon: "copy", command: () => message.value = "Local copy example." },
  { key: "export", label: "Export", icon: "download", disabled: true },
  { separator: true },
  { key: "remove", label: "Delete", icon: "trash", danger: true, command: () => message.value = "Deletion selected; the application adds confirmation." }
];
</script>

<template>
  <div class="wl-stack" data-space="lg">
    <div><WlMenu :items="items" aria-label="Static material commands" /></div>
    <div><WlButton @click="popup?.toggle($event)">{{ "Open popup menu" }}</WlButton><WlMenu
      ref="popup"
      popup
      :items="items"
      aria-label="Material popup commands"
    /></div>
    <p class="wl-text-small" role="status">{{ message }}</p>
    <p class="wl-text-small wl-text-muted">{{ "↑/↓, Home and End move focus. Escape closes the popup. Shortcut displays the key combination; the application adds its handler." }}</p>
  </div>
</template>