{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "navigation-menu",
  "type": "registry:ui",
  "title": "Navigation Menu",
  "description": "Top-level site navigation with animated mega-menu dropdowns and active-link states.",
  "dependencies": [
    "@radix-ui/react-navigation-menu",
    "@saasflare/ui",
    "class-variance-authority"
  ],
  "files": [
    {
      "path": "components/ui/navigation-menu.tsx",
      "type": "registry:ui",
      "content": "// @toreview\n\"use client\"\n\n/**\n * @fileoverview NavigationMenu primitive — site navigation with animated dropdowns, viewport support, and active indicators.\n * Built on Radix UI NavigationMenu. Part of the Saasflare base component layer.\n * @module packages/ui/components/ui/navigation-menu\n * @layer core\n *\n * @component\n * @example\n * import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink } from '@saasflare/ui';\n * <NavigationMenu>\n *   <NavigationMenuList>\n *     <NavigationMenuItem>\n *       <NavigationMenuTrigger>Products</NavigationMenuTrigger>\n *       <NavigationMenuContent>\n *         <NavigationMenuLink href=\"/docs\">Documentation</NavigationMenuLink>\n *       </NavigationMenuContent>\n *     </NavigationMenuItem>\n *   </NavigationMenuList>\n * </NavigationMenu>\n */\nimport * as React from \"react\"\nimport { cva } from \"class-variance-authority\"\nimport { CaretDownIcon } from \"@saasflare/ui\"\nimport * as NavigationMenuPrimitive from \"@radix-ui/react-navigation-menu\"\n\nimport { cn } from \"@saasflare/ui\"\nimport { useSaasflareProps, type SaasflareComponentProps } from \"@saasflare/ui\"\n\n/**\n * Props for {@link NavigationMenu}.\n *\n * `viewport` toggles the shared {@link NavigationMenuViewport} that hosts all\n * dropdown content in one animated panel; set it to `false` to render each\n * item's content as a self-contained popover below its trigger instead.\n */\ninterface NavigationMenuProps\n  extends Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Root>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {\n  /**\n   * Render the shared viewport panel for dropdown content.\n   *\n   * @default true\n   */\n  viewport?: boolean\n}\n\n/**\n * Site navigation root with animated dropdown menus, built on Radix NavigationMenu.\n *\n * Hosts a {@link NavigationMenuList} of items and, by default, a shared\n * {@link NavigationMenuViewport} that all dropdown content animates into.\n * Resolves the design-system axes and emits them as data attributes. Use for\n * horizontal header navigation.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenu({\n  className,\n  children,\n  viewport = true,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: NavigationMenuProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n\n  return (\n    <NavigationMenuPrimitive.Root\n      {...props}\n      data-slot=\"navigation-menu\"\n      data-viewport={String(viewport)}\n      data-surface={sf.surface}\n      data-radius={sf.radius}\n      data-animated={String(sf.animated)}\n      className={cn(\n        \"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center\",\n        className\n      )}\n    >\n      {children}\n      {viewport && <NavigationMenuViewport />}\n    </NavigationMenuPrimitive.Root>\n  )\n}\n\n/**\n * Horizontal list that lays out the top-level {@link NavigationMenuItem} entries.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuList({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {\n  return (\n    <NavigationMenuPrimitive.List\n      data-slot=\"navigation-menu-list\"\n      className={cn(\n        \"group flex flex-1 list-none items-center justify-center gap-1\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\n/**\n * A single menu entry — wraps a trigger/content pair or a standalone link.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuItem({\n  className,\n  ...props\n}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {\n  return (\n    <NavigationMenuPrimitive.Item\n      data-slot=\"navigation-menu-item\"\n      className={cn(\"relative\", className)}\n      {...props}\n    />\n  )\n}\n\n/**\n * cva builder for the trigger button styles. Applied internally by\n * {@link NavigationMenuTrigger}; call it on a plain {@link NavigationMenuLink}\n * to make a top-level link match the trigger appearance.\n */\nconst navigationMenuTriggerStyle = cva(\n  \"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent\"\n)\n\ninterface NavigationMenuTriggerProps\n  extends React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>,\n    Pick<SaasflareComponentProps, \"iconWeight\"> {}\n\n/**\n * Button that opens an item's {@link NavigationMenuContent}. Renders a caret\n * that rotates while open and follows the resolved `iconWeight` axis.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuTrigger({\n  className,\n  children,\n  iconWeight,\n  ...props\n}: NavigationMenuTriggerProps) {\n  const sf = useSaasflareProps({ iconWeight })\n  return (\n    <NavigationMenuPrimitive.Trigger\n      data-slot=\"navigation-menu-trigger\"\n      className={cn(navigationMenuTriggerStyle(), \"group\", className)}\n      {...props}\n    >\n      {children}{\" \"}\n      <CaretDownIcon weight={sf.iconWeight}\n        className=\"relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180\"\n        aria-hidden=\"true\"\n      />\n    </NavigationMenuPrimitive.Trigger>\n  )\n}\n\ninterface NavigationMenuContentProps\n  extends Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Content>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {}\n\n/**\n * Dropdown panel for a menu item. Renders into the shared\n * {@link NavigationMenuViewport} when the root has `viewport` enabled,\n * otherwise as a self-contained popover below its trigger.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuContent({\n  className,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: NavigationMenuContentProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n  return (\n    <NavigationMenuPrimitive.Content\n      data-slot=\"navigation-menu-content\"\n      data-surface={sf.surface}\n      data-radius={sf.radius}\n      data-animated={String(sf.animated)}\n      className={cn(\n        \"top-0 left-0 w-full p-2 pr-2.5 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out md:absolute md:w-auto\",\n        \"group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\ninterface NavigationMenuViewportProps\n  extends Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {}\n\n/**\n * Shared panel that hosts the active item's content and animates between sizes.\n * Rendered automatically by {@link NavigationMenu} unless `viewport` is `false`.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuViewport({\n  className,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: NavigationMenuViewportProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n  return (\n    <div className=\"absolute top-full left-0 isolate z-50 flex justify-center\">\n      <NavigationMenuPrimitive.Viewport\n        data-slot=\"navigation-menu-viewport\"\n        data-surface={sf.surface}\n        data-radius={sf.radius}\n        data-animated={String(sf.animated)}\n        className={cn(\n          \"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]\",\n          className\n        )}\n        {...props}\n      />\n    </div>\n  )\n}\n\ninterface NavigationMenuLinkProps\n  extends Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Link>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {}\n\n/**\n * Navigational link inside the menu — use `asChild` to compose with a framework\n * router link. Works standalone in an item or inside dropdown content.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuLink({\n  className,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: NavigationMenuLinkProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n  return (\n    <NavigationMenuPrimitive.Link\n      data-slot=\"navigation-menu-link\"\n      data-surface={sf.surface}\n      data-radius={sf.radius}\n      data-animated={String(sf.animated)}\n      className={cn(\n        \"flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\ninterface NavigationMenuIndicatorProps\n  extends Omit<React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>, keyof SaasflareComponentProps>,\n    SaasflareComponentProps {}\n\n/**\n * Animated arrow that tracks the active trigger and points at the open content.\n *\n * @component\n * @layer core\n */\nfunction NavigationMenuIndicator({\n  className,\n  surface,\n  radius,\n  animated,\n  iconWeight,\n  ...props\n}: NavigationMenuIndicatorProps) {\n  const sf = useSaasflareProps({ surface, radius, animated, iconWeight })\n  return (\n    <NavigationMenuPrimitive.Indicator\n      data-slot=\"navigation-menu-indicator\"\n      data-surface={sf.surface}\n      data-radius={sf.radius}\n      data-animated={String(sf.animated)}\n      className={cn(\n        \"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in\",\n        className\n      )}\n      {...props}\n    >\n      <div className=\"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md\" />\n    </NavigationMenuPrimitive.Indicator>\n  )\n}\n\nexport {\n  NavigationMenu,\n  type NavigationMenuProps,\n  NavigationMenuList,\n  NavigationMenuItem,\n  NavigationMenuContent,\n  NavigationMenuTrigger,\n  NavigationMenuLink,\n  NavigationMenuIndicator,\n  NavigationMenuViewport,\n  navigationMenuTriggerStyle,\n}\n",
      "target": "components/ui/navigation-menu.tsx"
    }
  ],
  "$meta": {
    "source": "https://ui.saasflare.io/r/navigation-menu.json"
  }
}
