Navigation Menu
Site-header navigation: a <nav> list of top-level links and disclosure dropdowns. For app command menus use Menubar or DropdownMenu.
Overview
- Items: a
NavigationMenuItemholds either aNavigationMenuLinkor aNavigationMenuTrigger(a button witharia-expanded) plus itsNavigationMenuContent(a popover). - Closing: Escape or a click outside closes the dropdown and returns focus to the trigger; following a link closes it too.
- Links: style plain links like triggers with
navigationMenuTriggerStyle(), and mark the current page witharia-current="page". - Hover: dropdowns open on press; with
openOnHoverthey also open when the pointer rests on a trigger (delay,closeDelay). That's a non-modal "peek" that leaves focus alone, switches at once to another trigger and closes when the pointer leaves or on Escape. Pressing a peeked trigger keeps it open as a regular dropdown. - `NavigationMenuIndicator`: add it after the list for an arrow that slides under the open trigger.
Installation
CLI
Manual
- 1
Register the @fma-ds namespace in components.json (once)
- 2
Add the item
Files land in
components/fma-ds/navigation-menu.tsx; npm and registry dependencies are installed along with them.
Dependencies
- npm
- class-variance-authority@^0.7.1cn@^0.5.0lucide-react@^1.61.0react-aria-components@^1.22.1
- Registry
- None