WlContextMenu

Pointer and keyboard context menu with nested and checked items.
Components / Navigation v1.0.0-rc.1

Placement

· Compact header: false

Full example
<div class="wl-stack" data-space="md">
  <WlContextMenu
    :items="items"
    aria-label="Material actions"
    data-context-example
    
  >
    <WlCard padding="md"><p>{{ "Material" }} · Shift+F10</p></WlCard>
  </WlContextMenu>
  <p role="status" class="wl-text-small">{{ selection }} · {{ "Compact header" }}: {{ compact }}</p>
</div>

Context actions with nested choices

Pointer and keyboard context menu with nested and checked items.

· Compact header: false

Full example
<script setup lang="ts">
import { WlCard, WlContextMenu, type WlMenuItem } from "legato-ui";
import { computed, ref } from "vue";

const selection = ref("");
const compact = ref(false);
const items = computed<WlMenuItem[]>(() => [
  { label: "Edit", icon: "edit", command: () => { selection.value = "Editing"; } },
  { label: "View", items: [
    { label: "Compact header", type: "checkbox", checked: compact.value, onCheckedChange: (checked) => { compact.value = checked; } }
  ] },
  { label: "Unavailable", disabled: true },
  { separator: true },
  { label: "Delete", icon: "trash", danger: true, command: () => { selection.value = "Deletion"; } }
]);
</script>

<template>
  <div class="wl-stack" data-space="md">
    <WlContextMenu :items="items" aria-label="Material actions">
      <WlCard padding="md"><p>{{ "Material" }} · Shift+F10</p></WlCard>
    </WlContextMenu>
    <p role="status" class="wl-text-small">{{ selection }} · {{ "Compact header" }}: {{ compact }}</p>
  </div>
</template>