Skip to content

Design system

Documentation

DesignComponents / Menu

Components / Menu

Stable

Menu

Build persistent nested navigation separate from action DropdownMenu.

On this page

Examples

Usage

import { Menu } from "@phuctech/ui/components/menu";

<Menu label="Workspace navigation" items={items} currentPath="/projects" />

Menu is a persistent navigation landmark. Give every item a stable ID and either an href or child destinations. Use DropdownMenu for contextual actions.

Keyboard behavior

Tab enters the roving sequence once. Up/Down and Home/End move between visible enabled actions. Right expands a branch, and Left collapses it or focuses its parent. Ordinary links remain links, and the current route receives aria-current="page".

API

Component API
PropTypeDefaultDescriptionConstraints
labelstringrequiredAccessible name for the nav landmark.Use a specific navigation purpose.
itemsreadonly MenuItem[]requiredNested links and disclosure branches.Use unique stable IDs; each item needs href or children.
currentPathstring—Marks the matching href with aria-current page.Pass the current route path from the consuming app.
expandedKeys / defaultExpandedKeysreadonly string[][]Controlled or initial expanded branches.Use item IDs with children.
onExpandedKeysChange(keys: readonly string[]) => void—Called when a branch is toggled.Update controlled expansion in the feature.
disabledboolean on MenuItemfalseKeeps an unavailable destination readable but non-interactive.Do not use disabled styling as a substitute for authorization.

Accessibility

The root is a named nav landmark with nested lists, links, and disclosure buttons. Every disclosure action has a branch-specific name and expanded state. Disabled links are removed from roving keyboard focus.

  • DropdownMenu presents actions in a temporary popup.
  • Breadcrumb identifies the current path hierarchy.
  • Drawer can host this navigation on narrow screens.