ui-kit0.0

Navigation

Navigation menu

Site menus with rich panels.

Usage

Every trigger shares one floating panel. Hover a trigger (with a short intent delay) or click it; moving to another trigger resizes the panel, slides the new content in from the side you travelled and glides the caret under the active trigger.

When to use

  • Site headers whose sections each hold a handful of destinations that need a title and a line of description.
  • Next to a logo and call-to-action in a navbar, on desktop widths.

Not for: lists of commands or actions (use a dropdown menu) or app navigation with many levels (use a sidebar).

Accordion on narrow screens

Below collapseBelow (768px) the menu becomes an accordion: each trigger expands its links in place. Force it with mode="accordion", for example when the menu sits inside the mobile navbar sheet.

API

NavigationMenu

PropTypeDefaultDescription
value / defaultValue / onValueChangestring / string / (value) => void''The open item’s value; empty when closed.
mode'auto' | 'menu' | 'accordion''auto'auto switches by viewport width.
collapseBelownumber768Viewport width (px) for the accordion in auto mode.
openDelay / closeDelaynumber120 / 240Hover intent, in ms.

NavigationMenuItem / NavigationMenuLink

PropTypeDefaultDescription
valuestring—Item only: identifies the item. Defaults to a generated id.
activeboolean—Link only: aria-current="page".
asChildbooleanfalseLink only: render the child element, e.g. a Next.js Link.

Also: NavigationMenuList, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLinkTitle and NavigationMenuLinkDescription. Lay content out with the ui-nav-menu-grid class and its --ui-nav-cols / --ui-nav-width variables.

Keyboard

KeyAction
← →Between triggers and links; switches the open panel.
↓Opens the panel and moves into it. Inside, arrows move between links.
↑From the first link, back to the trigger.
Enter / SpaceToggles the panel (focus stays on the trigger).
TabFrom an open trigger, into the panel.
EscCloses the panel and returns focus to its trigger.

Accessibility

  • A labelled nav landmark; triggers are buttons with aria-expanded and aria-controls (the disclosure navigation pattern).
  • The panel is in the top layer, so no parent can clip it. Focus leaving the menu closes it.
  • Hover never opens a panel on touch screens; tapping does.

Motion

  • First open: the panel rises in from the caret (soft rise).
  • Between items: the panel moves and resizes on the smooth spring, the old content leaves and the new content enters from the side of travel; the caret glides under the active trigger.
  • Reduced motion keeps the state change and drops the movement.