WlNavigationMenu
Placement
Tab moves between links and disclosures. Enter or Space opens a group. Escape closes it and returns focus to its heading.
Workspace section
Full example
<div class="wl-stack" data-space="sm">
<WlNavigationMenu :items="items" label="Project navigation" />
<p :id="workspace">{{ "Workspace section" }}</p>
</div>Content
Workspace section
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.
Workspace section
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>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
items * | readonly WlNavigationMenuItem[] | Required | Links and one level of disclosure groups. |
label | string | Not set | Accessible name of the navigation landmark. |
orientation | "horizontal" | | "horizontal" | Layout of the top-level links and groups. |
pt | WlPt< | Not set | Attributes of the landmark, lists, items, links and disclosures. |
Events
No public events.
Slots
| Slot | Type / values | Content |
|---|---|---|
link | link?(props: { item: WlNavigationMenuLink }): unknown; | Customize the content of a navigation link. |
Pass-through: pt
Sections WlNavigationMenu are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | nav.wl-navigation-menu | Main element of the component. |
list | ul.wl-navigation-menu__list | List of top-level navigation items. |
item | li.wl-navigation-menu__item | One repeated item. |
link | a.wl-navigation-menu__link | Focusable menu action or link. |
disclosure | details.wl-navigation-menu__disclosure | Expandable navigation group. |
group | ul.wl-navigation-menu__group | List of links in the group. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Tab moves between links and disclosures. Enter or Space opens a group. Escape closes it and returns focus to its heading.
- Give this navigation landmark a unique name if the page has more than one navigation area.
- Mark the current destination with the active item so the link can expose its current-page state.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.