Accessible nav landmark with optional mega-panel submenus, keyboard navigation, and surface-aware styling.
Horizontal or vertical orientation
Optional shared viewport panel or inline per-item panels
WAI-ARIA disclosure navigation: each panel follows its button in the tab order, with Arrow/Home/End/Escape keys
Surface-aware (pixel / linear)
SSR-safe nav landmark
Status
stable
Category
navigation
Since
v1.9.0
API
import { PixelNavigationMenu } from '@pxlkit/ui-kit';
Prop
Type
Default
Description
items* (required)
PixelNavigationMenuItem[]
—
The items, in order.
orientation
'horizontal' | 'vertical'
'horizontal'
Items in a row or a column; also the arrow keys that move between them.
viewport
boolean
true
One shared panel below the list, instead of a panel under each item.
surface
'pixel' | 'linear'
—
Surface override; defaults to the nearest provider.
ariaLabel
string
'Main navigation'
Accessible name for the nav landmark. Required when more than one nav lands on the same page (WCAG 2.4.6). Defaults to "Main navigation".
Also takes the native attributes and event handlers of its element (HTMLAttributes<HTMLElement>), except children.
ref points to its element (HTMLElement).
Accessibility
WCAG target: 2.1 AA
disclosure
link
Follows the WAI-ARIA disclosure navigation pattern, without menu roles (those are for application menus): a <nav> landmark — give it a unique ariaLabel when the page has more than one (WCAG 2.4.6) — holding a list of links, and of buttons with aria-expanded and aria-controls for the items with content. Each panel is a plain container rendered right after its button, inside the same list item, so Tab moves from the button into the open panel; the shared viewport is only drawn below the whole list. A click, or Enter / Space on the button, toggles the panel; focus alone never opens it. A mouse pointing at an item opens its panel — touch and pen pointers do not, so a tap opens it once — and the pointer leaving the menu closes that panel, unless a click on its button kept it open: a panel opened by a click stays open until a click on its button or another one, or Escape. A panel that closes while focus is inside it hands focus back to its button. An item with both an href and content is a button whose activation toggles the panel instead of navigating.
Keyboard
Key
Action
When
Tab
Move to the next link or button; from the button of an open panel, into the panel
—
Shift+Tab
Move to the previous link or button
—
Enter
Toggle the panel of a button, or follow a link; invokes onSelect
—
Space
Toggle the panel of a button; invokes onSelect
—
ArrowRight
Focus next item, wrapping round
horizontal
ArrowLeft
Focus previous item, wrapping round
horizontal
ArrowDown
Focus the first link of the open panel
horizontal, on the button of an open panel
ArrowDown
Focus next item, wrapping round
vertical
ArrowUp
Focus previous item, wrapping round
vertical
Home
Focus first item
—
End
Focus last item
—
Escape
Close the open panel; focus on its button or inside it returns to the button