WlNavigationMenu

A landmark with links and one level of disclosure groups.
Components / Navigation v1.4.0

Placement

Tab moves between links and disclosures. Enter or Space opens a group. Escape closes it and returns focus to its heading.

Full example
<div class="wl-stack" data-space="sm">
  <WlNavigationMenu :items="items" label="Project navigation"  />
  <p :id="workspace">{{ "Workspace section" }}</p>
</div>

Content

Full example
<div class="wl-stack" data-space="sm">
  <WlNavigationMenu :items="items" label="Project navigation"  />
  <p :id="workspace">{{ "Workspace section" }}</p>
</div>

Link content and states

The current link leads to this example’s workspace section. Open the references group to compare an external link and a disabled item.

Full example
<script setup lang="ts">
import { WlIcon, WlNavigationMenu, type WlNavigationMenuItem } from "legato-ui";
import { useWlId } from "legato-ui/composables";
import { computed } from "vue";

const workspace = `nav-workspace-${useWlId()}`;
const items = computed<readonly WlNavigationMenuItem[]>(() => [
  { key: "workspace", label: "Workspace", href: `#${workspace}`, active: true },
  { key: "docs", label: "Reference links", children: [
    { key: "vue", label: "Vue", href: "https://vuejs.org/guide/", external: true },
    { key: "archive", label: "Archive", disabled: true }
  ] }
]);
</script>

<template>
  <div class="wl-stack" data-space="sm">
    <WlNavigationMenu :items="items" label="Project navigation" orientation="vertical">
      <template #link="{ item }">
        <span class="wl-inline" data-space="xs">
          <WlIcon v-if="item.external" name="external-link" :size="14" />
          {{ item.label }}
        </span>
      </template>
    </WlNavigationMenu>
    <p :id="workspace">{{ "Workspace section" }}</p>
  </div>
</template>