fma-ds

Navigation Menu

Site-header navigation: a <nav> list of top-level links and disclosure dropdowns. For app command menus use Menubar or DropdownMenu.

NavigationoriginalMITChangelogRegistry JSON

Overview

  • Items: a NavigationMenuItem holds either a NavigationMenuLink or a NavigationMenuTrigger (a button with aria-expanded) plus its NavigationMenuContent (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 with aria-current="page".
  • Hover: dropdowns open on press; with openOnHover they 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

  1. 1

    Register the @fma-ds namespace in components.json (once)

    components.json
    {  "registries": {    "@fma-ds": "https://ds.fmartinsandre.dev.br/r/{name}.json"  }}
  2. 2

    Add the item

    pnpm dlx shadcn@latest add @fma-ds/navigation-menu

    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