{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "navigation-menu", "type": "registry:block", "title": "Navigation Menu", "description": "Nav bars with dropdowns, mega menus, and nested links.", "author": "Wensity ", "dependencies": [ "@base-ui/react", "@tabler/icons-react", "clsx", "framer-motion", "tailwind-merge" ], "registryDependencies": [], "files": [ { "path": "registry/wensity/lib/utils.ts", "type": "registry:lib", "target": "@lib/utils.ts", "content": "import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n" }, { "path": "registry/wensity/navigation-menu.tsx", "type": "registry:component", "target": "@components/wensity/navigation-menu.tsx", "content": "\"use client\";\n\n/**\n * Navigation Menu — Base UI Navigation Menu foundation (Phase 5).\n * Shared overlay surface (Portal/Positioner/Popup/Viewport) is rendered\n * by the Root wrapper; per-item Content mounts inside the shared Viewport.\n *\n * Panels use solid `--primitive-surface-overlay` + `--primitive-shadow-overlay`\n * + `--primitive-radius-surface`. Item hover uses `--primitive-surface-hover`,\n * descriptions the muted-foreground role. Positioner: z `--primitive-z-popover`,\n * collisionPadding 12. Viewport transition CSS-driven and RM-gated.\n *\n * D-17: asChild patterns migrated to Base UI's `render` prop.\n *\n * Sub-menu family (Sub / SubTrigger / SubContent) stays custom — Base UI\n * Navigation Menu has no built-in submenu API. Preserved for API compat.\n */\n\nimport * as React from \"react\";\nimport { NavigationMenu as BaseNav } from \"@base-ui/react/navigation-menu\";\nimport { AnimatePresence, motion, useReducedMotion } from \"framer-motion\";\nimport { IconChevronDown, IconChevronRight } from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\n\n/** Motion tiers, the same speeds as the --primitive-motion-* tokens. */\nconst SPRING = {\n fast: { type: \"spring\", duration: 0.08, bounce: 0 },\n moderate: { type: \"spring\", duration: 0.16, bounce: 0 },\n slow: { type: \"spring\", duration: 0.24, bounce: 0 },\n} as const;\n\n/* ─── Types ─────────────────────────────────────────────────── */\n\nexport type NavigationMenuSize = \"default\" | \"compact\";\nexport type NavigationMenuAlign = \"start\" | \"center\" | \"end\";\n\nexport interface NavigationMenuProps\n extends Omit<\n React.ComponentPropsWithoutRef,\n \"value\" | \"defaultValue\" | \"onValueChange\" | \"delay\"\n > {\n size?: NavigationMenuSize;\n /** Delay in ms before opening a menu on hover. Default 120. */\n delayDuration?: number;\n /**\n * @deprecated Base UI owns the hover bridge/close timing; kept for API compat.\n */\n skipDelayOnSwitch?: boolean;\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n}\n\nexport type NavigationMenuListProps = React.ComponentPropsWithoutRef;\n\nexport type NavigationMenuItemProps = React.ComponentPropsWithoutRef;\n\nexport interface NavigationMenuTriggerProps\n extends React.ComponentPropsWithoutRef {\n /** Whether to show a chevron indicator. Default true. */\n showChevron?: boolean;\n}\n\nexport interface NavigationMenuContentProps\n extends React.ComponentPropsWithoutRef {\n /** Force a specific width. Use for mega menus (e.g. \"w-[48rem]\"). */\n width?: string;\n /**\n * @deprecated Base UI Navigation Menu uses a shared Viewport with\n * automatic alignment; per-content align is not supported.\n */\n align?: NavigationMenuAlign;\n}\n\nexport interface NavigationMenuLinkProps\n extends React.ComponentPropsWithoutRef {\n asChild?: boolean;\n}\n\nexport type NavigationMenuIconProps = React.ComponentPropsWithoutRef;\n\nexport type NavigationMenuDescriptionProps = React.HTMLAttributes;\n\nexport interface NavigationMenuSubProps {\n children: React.ReactNode;\n}\n\nexport type NavigationMenuSubTriggerProps = React.ButtonHTMLAttributes;\n\nexport type NavigationMenuSubContentProps = React.HTMLAttributes;\n\nexport type NavigationMenuGroupProps = React.HTMLAttributes;\n\nexport type NavigationMenuGroupHeadingProps = React.HTMLAttributes;\n\n/* ─── Density context ───────────────────────────────────────── */\n\nconst NavigationMenuSizeContext =\n React.createContext(\"default\");\nconst useNavSize = () => React.useContext(NavigationMenuSizeContext);\n\n/* ─── Constants ─────────────────────────────────────────────── */\n\n\nconst overlaySurfaceClass = \"text-[var(--foreground)]\";\n\nconst popupMotionClass = cn(\n \"origin-[var(--transform-origin)] transform-gpu outline-none\",\n \"transition-[opacity,scale] duration-[var(--primitive-motion-fast)] ease-[var(--primitive-ease,cubic-bezier(0.23,1,0.32,1))]\",\n \"data-[ending-style]:duration-[var(--primitive-motion-fast-exit)]\",\n \"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0\",\n \"data-[starting-style]:scale-[0.96] data-[ending-style]:scale-[0.96]\",\n \"motion-reduce:transition-none motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100\",\n);\n\nconst viewportMotionClass = cn(\n \"relative overflow-hidden\",\n \"transition-[width,height] duration-[var(--primitive-motion-moderate)] ease-[var(--primitive-ease,cubic-bezier(0.23,1,0.32,1))]\",\n \"motion-reduce:transition-none\",\n);\n\n/* ─── ──────────────────────────────────────── */\n\nexport const NavigationMenu = React.forwardRef<\n HTMLElement,\n NavigationMenuProps\n>(function NavigationMenu(\n {\n size = \"default\",\n delayDuration = 120,\n skipDelayOnSwitch: _skipDelayOnSwitch,\n value: valueProp,\n defaultValue,\n onValueChange,\n className,\n children,\n \"aria-label\": ariaLabel = \"Main navigation\",\n ...props\n },\n ref,\n) {\n const handleValueChange = React.useMemo(\n () =>\n onValueChange\n ? (v: unknown) => onValueChange((v ?? null) as string | null)\n : undefined,\n [onValueChange],\n );\n\n return (\n \n }\n delay={delayDuration}\n value={valueProp as never}\n defaultValue={defaultValue as never}\n onValueChange={handleValueChange as never}\n data-size={size}\n aria-label={ariaLabel}\n className={cn(\"relative\", className)}\n {...props}\n >\n {children}\n \n \n \n \n \n \n \n \n \n );\n});\n\n/* ─── Glide hover ───────────────────────────────────────────── */\n\n/**\n * One hover highlight per list. It glides (fast motion tier) to the item\n * nearest the pointer, stays lit across the gaps between items, fades in where\n * the pointer enters instead of sliding over from its last spot, and a click\n * in a gap goes to the lit item. Items opt in with `data-glide-item`.\n */\ntype GlideRect = {\n x: number;\n y: number;\n w: number;\n h: number;\n session: number;\n visible: boolean;\n};\n\nconst GLIDE_SPRING = { type: \"spring\", duration: 0.08, bounce: 0 } as const;\n\nfunction useGlideHover(\n axis: \"x\" | \"y\" | \"xy\",\n {\n gapClick = true,\n itemSelector = \"[data-glide-item]\",\n }: { gapClick?: boolean; itemSelector?: string } = {},\n) {\n const containerRef = React.useRef(null);\n const activeRef = React.useRef(null);\n const sessionRef = React.useRef(0);\n const [glide, setGlide] = React.useState(null);\n\n const pick = React.useCallback(\n (clientX: number, clientY: number) => {\n const root = containerRef.current;\n if (!root) return;\n let best: HTMLElement | null = null;\n let bestDistance = Infinity;\n for (const item of root.querySelectorAll(itemSelector)) {\n if (item.matches(':disabled, [data-disabled], [aria-disabled=\"true\"]')) continue;\n const r = item.getBoundingClientRect();\n if (clientX >= r.left && clientX <= r.right && clientY >= r.top && clientY <= r.bottom) {\n best = item;\n break;\n }\n const dx = axis === \"y\" ? 0 : clientX - (r.left + r.width / 2);\n const dy = axis === \"x\" ? 0 : clientY - (r.top + r.height / 2);\n const distance = dx * dx + dy * dy;\n if (distance < bestDistance) {\n bestDistance = distance;\n best = item;\n }\n }\n activeRef.current = best;\n if (!best) return;\n const rootRect = root.getBoundingClientRect();\n const r = best.getBoundingClientRect();\n const x = r.left - rootRect.left - root.clientLeft + root.scrollLeft;\n const y = r.top - rootRect.top - root.clientTop + root.scrollTop;\n const session = sessionRef.current;\n setGlide((prev) =>\n prev &&\n prev.visible &&\n prev.session === session &&\n prev.x === x &&\n prev.y === y &&\n prev.w === r.width &&\n prev.h === r.height\n ? prev\n : { x, y, w: r.width, h: r.height, session, visible: true },\n );\n },\n [axis, itemSelector],\n );\n\n const handlers = {\n onPointerEnter(event: React.PointerEvent) {\n if (event.pointerType !== \"mouse\") return;\n sessionRef.current += 1;\n pick(event.clientX, event.clientY);\n },\n onPointerMove(event: React.PointerEvent) {\n if (event.pointerType === \"mouse\") pick(event.clientX, event.clientY);\n },\n onPointerLeave() {\n activeRef.current = null;\n setGlide((prev) => (prev ? { ...prev, visible: false } : prev));\n },\n onClick(event: React.MouseEvent) {\n if (!gapClick) return;\n // Membership, not closest(): a scoped selector (\":scope > li > …\") only\n // matches from the container, so test each item for the click target.\n const root = containerRef.current;\n const target = event.target as Node;\n if (root && Array.from(root.querySelectorAll(itemSelector)).some((item) => item.contains(target))) return;\n activeRef.current?.click();\n },\n };\n\n return { containerRef, glide, handlers };\n}\n\nfunction GlideHighlight({\n glide,\n className,\n}: {\n glide: GlideRect | null;\n className?: string;\n}) {\n const reduceMotion = useReducedMotion();\n if (!glide) return null;\n const box = { x: glide.x, y: glide.y, width: glide.w, height: glide.h };\n return (\n \n );\n}\n\n/**\n * One callback ref for the glide container and the caller's ref, so the caller\n * always gets the mounted element (also on branches without the glide).\n */\nfunction assignGlideRef(ref: React.Ref | undefined, node: T | null) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as React.RefObject).current = node;\n}\n\nfunction useGlideRef(\n forwarded: React.ForwardedRef,\n containerRef: React.RefObject,\n) {\n return React.useCallback(\n (node: T | null) => {\n assignGlideRef(containerRef, node);\n assignGlideRef(forwarded, node);\n },\n [forwarded, containerRef],\n );\n}\n\n/* ─── ──────────────────────────────────── */\n\nexport const NavigationMenuList = React.forwardRef<\n HTMLUListElement,\n NavigationMenuListProps\n>(function NavigationMenuList(\n { className, children, onPointerEnter, onPointerMove, onPointerLeave, onClick, ...props },\n ref,\n) {\n const size = useNavSize();\n // Top-level triggers and links only; links inside open panels keep their own hover.\n const glide = useGlideHover(\"x\", { itemSelector: \":scope > li > [data-glide-item]\" });\n const listRef = useGlideRef(ref, glide.containerRef);\n return (\n li>[data-glide-item]:hover]:bg-transparent\",\n className,\n )}\n {...props}\n onPointerEnter={(event) => {\n onPointerEnter?.(event);\n glide.handlers.onPointerEnter(event);\n }}\n onPointerMove={(event) => {\n onPointerMove?.(event);\n glide.handlers.onPointerMove(event);\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event);\n glide.handlers.onPointerLeave();\n }}\n onClick={(event) => {\n onClick?.(event);\n glide.handlers.onClick(event);\n }}\n >\n \n {children}\n \n );\n});\n\n/* ─── ──────────────────────────────────── */\n\nexport const NavigationMenuItem = React.forwardRef<\n HTMLLIElement,\n NavigationMenuItemProps\n>(function NavigationMenuItem({ className, ...props }, ref) {\n return (\n \n );\n});\n\n/* ─── ───────────────────────────────── */\n\nexport const NavigationMenuTrigger = React.forwardRef<\n HTMLButtonElement,\n NavigationMenuTriggerProps\n>(function NavigationMenuTrigger(\n { className, showChevron = true, children, ...props },\n ref,\n) {\n const size = useNavSize();\n return (\n \n {children}\n {showChevron && (\n \n )}\n \n );\n});\n\n/* ─── ───────────────────────────────── */\n\nexport const NavigationMenuContent = React.forwardRef<\n HTMLDivElement,\n NavigationMenuContentProps\n>(function NavigationMenuContent(\n { className, width, align: _align, children, ...props },\n ref,\n) {\n return (\n \n {children}\n \n );\n});\n\n/* ─── ──────────────────────────────────── */\n\nexport const NavigationMenuLink = React.forwardRef<\n HTMLAnchorElement,\n NavigationMenuLinkProps\n>(function NavigationMenuLink(\n { className, asChild, active, children, ...props },\n ref,\n) {\n const size = useNavSize();\n const linkClass = cn(\n \"group/nav-link inline-flex select-none items-center gap-1.5 rounded-[var(--primitive-radius-item)] font-medium outline-none\",\n \"transition-[color,background-color,translate] duration-[var(--primitive-motion-fast)] ease-out motion-reduce:transition-none\",\n \"text-[var(--primitive-text-secondary)]\",\n \"hover:text-[var(--foreground)] hover:bg-[var(--primitive-surface-hover)]\",\n \"data-[active]:text-[var(--foreground)]\",\n \"focus-visible:ring-2 focus-visible:ring-[var(--primitive-ring)]\",\n \"active:translate-y-px motion-reduce:active:translate-y-0\",\n size === \"compact\"\n ? \"px-2.5 py-1.5 text-[13px]\"\n : \"px-3 py-2 text-[14px]\",\n className,\n );\n\n if (asChild && React.isValidElement(children)) {\n return (\n \n );\n }\n\n return (\n \n {children}\n \n );\n});\n\n/* ─── ──────────────────────────────────── */\n\nexport const NavigationMenuIcon = React.forwardRef<\n HTMLSpanElement,\n NavigationMenuIconProps\n>(function NavigationMenuIcon({ className, ...props }, ref) {\n const size = useNavSize();\n return (\n \n );\n});\n\n/* ─── ───────────────────────────── */\n\nexport const NavigationMenuDescription = React.forwardRef<\n HTMLSpanElement,\n NavigationMenuDescriptionProps\n>(function NavigationMenuDescription({ className, ...props }, ref) {\n const size = useNavSize();\n return (\n \n );\n});\n\n/* ─── (custom, click-toggle) ────────────── */\n\ntype NavigationMenuSubContextValue = {\n open: boolean;\n setOpen: (open: boolean) => void;\n contentId: string;\n};\n\nconst NavigationMenuSubContext =\n React.createContext(null);\n\nfunction useNavigationMenuSubContext(): NavigationMenuSubContextValue {\n const ctx = React.useContext(NavigationMenuSubContext);\n if (!ctx) {\n throw new Error(\n \"NavigationMenuSub components must be used within \",\n );\n }\n return ctx;\n}\n\nexport function NavigationMenuSub({ children }: NavigationMenuSubProps) {\n const [open, setOpen] = React.useState(false);\n const reactId = React.useId();\n const ctx = React.useMemo(\n () => ({ open, setOpen, contentId: `nav-sub-${reactId}` }),\n [open, reactId],\n );\n\n return (\n \n
{children}
\n
\n );\n}\nNavigationMenuSub.displayName = \"NavigationMenuSub\";\n\nexport const NavigationMenuSubTrigger = React.forwardRef<\n HTMLButtonElement,\n NavigationMenuSubTriggerProps\n>(function NavigationMenuSubTrigger(\n { className, children, onClick, ...props },\n ref,\n) {\n const { open, setOpen, contentId } = useNavigationMenuSubContext();\n const prefersReducedMotion = useReducedMotion();\n return (\n {\n onClick?.(e);\n if (!e.defaultPrevented) setOpen(!open);\n }}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center gap-2 rounded-[var(--primitive-radius-item)] px-2.5 py-2 text-sm outline-none\",\n \"transition-[color,background-color,translate] duration-[var(--primitive-motion-fast)] ease-out motion-reduce:transition-none\",\n \"text-[var(--foreground)]\",\n \"hover:bg-[var(--primitive-surface-hover)]\",\n \"data-popup-open:bg-[var(--primitive-surface-hover)] data-open:bg-[var(--primitive-surface-hover)]\",\n \"focus-visible:ring-2 focus-visible:ring-[var(--primitive-ring)]\",\n \"active:translate-y-px motion-reduce:active:translate-y-0\",\n className,\n )}\n {...props}\n >\n {children}\n \n \n \n \n \n \n );\n});\n\nexport const NavigationMenuSubContent = React.forwardRef<\n HTMLDivElement,\n NavigationMenuSubContentProps\n>(function NavigationMenuSubContent(\n { className, children, ...props },\n ref,\n) {\n const { open, contentId } = useNavigationMenuSubContext();\n const prefersReducedMotion = useReducedMotion();\n\n // Destructure HTML-only event handlers that conflict with Framer Motion's\n // drag types to prevent TS2322 when spreading onto motion.div.\n const {\n onDrag: _onDrag,\n onDragStart: _onDragStart,\n onDragEnd: _onDragEnd,\n onAnimationStart: _onAnimationStart,\n ...safeProps\n } = props;\n\n return (\n \n {open && (\n \n {children}\n \n )}\n \n );\n});\n\n/* ─── ─────────────────────────────────── */\n\nexport const NavigationMenuGroup = React.forwardRef<\n HTMLDivElement,\n NavigationMenuGroupProps\n>(function NavigationMenuGroup({ className, children, ...props }, ref) {\n return (\n \n {children}\n \n );\n});\n\n/* ─── ──────────────────────────── */\n\nexport const NavigationMenuGroupHeading = React.forwardRef<\n HTMLHeadingElement,\n NavigationMenuGroupHeadingProps\n>(function NavigationMenuGroupHeading({ className, children, ...props }, ref) {\n return (\n \n {children}\n \n );\n});\n" } ], "cssVars": { "theme": { "font-sans": "var(--font-satoshi, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif)", "font-display": "var(--font-satoshi, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif)", "font-heading": "var(--font-cabinet, ui-sans-serif, system-ui, sans-serif)", "color-background": "var(--background)", "color-foreground": "var(--foreground)", "color-surface": "var(--surface)", "color-surface-muted": "var(--surface-muted)", "color-border": "var(--border)", "color-border-strong": "var(--border-strong)", "color-muted": "var(--muted)", "color-muted-foreground": "var(--muted-foreground)", "color-ring": "var(--ring)", "color-chili-50": "#fff1ee", "color-chili-100": "#ffe2db", "color-chili-200": "#ffa896", "color-chili-300": "#ff8a73", "color-chili-400": "#f15a45", "color-chili-500": "#cd1c18", "color-chili-600": "#b31614", "color-chili-700": "#9b1313", "color-chili-800": "#6a0d0e", "color-chili-900": "#38000a", "color-chili-950": "#1f0006", "color-primitive-surface-elevated": "var(--primitive-surface-elevated)", "color-primitive-surface-overlay": "var(--primitive-surface-overlay)", "color-primitive-surface-hover": "var(--primitive-surface-hover)", "color-primitive-surface-active": "var(--primitive-surface-active)", "color-primitive-surface-selected": "var(--primitive-surface-selected)", "color-primitive-border-subtle": "var(--primitive-border-subtle)", "color-primitive-ring": "var(--primitive-ring)", "color-primitive-text-secondary": "var(--primitive-text-secondary)", "color-primitive-text-placeholder": "var(--primitive-text-placeholder)", "color-primitive-text-inverse": "var(--primitive-text-inverse)", "color-primitive-destructive": "var(--primitive-destructive)", "color-primitive-destructive-hover": "var(--primitive-destructive-hover)", "color-primitive-destructive-active": "var(--primitive-destructive-active)", "color-primitive-destructive-foreground": "var(--primitive-destructive-foreground)", "color-primitive-destructive-surface": "var(--primitive-destructive-surface)", "color-primitive-destructive-border": "var(--primitive-destructive-border)", "color-primitive-success": "var(--primitive-success)", "color-primitive-warning": "var(--primitive-warning)", "color-primitive-info": "var(--primitive-info)", "color-primitive-control-solid": "var(--primitive-control-solid)", "color-primitive-control-solid-hover": "var(--primitive-control-solid-hover)", "color-primitive-control-solid-active": "var(--primitive-control-solid-active)", "color-primitive-control-solid-foreground": "var(--primitive-control-solid-foreground)", "color-primitive-chart-1": "var(--primitive-chart-1)", "color-primitive-chart-2": "var(--primitive-chart-2)", "color-primitive-chart-3": "var(--primitive-chart-3)", "color-primitive-chart-4": "var(--primitive-chart-4)", "color-primitive-chart-5": "var(--primitive-chart-5)", "color-primitive-chart-6": "var(--primitive-chart-6)", "radius-primitive": "var(--primitive-radius)", "radius-primitive-control": "var(--primitive-radius-control)", "radius-primitive-control-sm": "var(--primitive-radius-control-sm)", "radius-primitive-surface": "var(--primitive-radius-surface)", "radius-primitive-popup": "var(--primitive-radius-popup)", "radius-primitive-item": "var(--primitive-radius-item)", "font-primitive-sans": "var(--primitive-font-sans)", "font-primitive-display": "var(--primitive-font-display)", "font-primitive-mono": "var(--primitive-font-mono)", "spacing-primitive-control-height-sm": "var(--primitive-control-height-sm)", "spacing-primitive-control-height-md": "var(--primitive-control-height-md)", "spacing-primitive-control-height-lg": "var(--primitive-control-height-lg)" }, "light": { "background": "#fafafa", "foreground": "#0a0a0a", "surface": "#ffffff", "surface-muted": "#f4f4f5", "border": "rgba(10, 10, 10, 0.08)", "border-strong": "rgba(10, 10, 10, 0.16)", "muted": "#f4f4f5", "muted-foreground": "#52525b", "ring": "#cd1c18", "pattern-fg": "rgba(10, 10, 10, 0.07)", "llb-primary": "#18181b", "llb-primary-fg": "#ffffff", "llb-success": "#1f883d", "llb-error": "#cf222e", "primitive-surface-elevated": "#ffffff", "primitive-surface-overlay": "#ffffff", "primitive-surface-hover": "color-mix(in srgb, var(--foreground) 4%, transparent)", "primitive-surface-active": "color-mix(in srgb, var(--foreground) 7%, transparent)", "primitive-surface-selected": "color-mix(in srgb, var(--foreground) 6%, transparent)", "primitive-border-subtle": "color-mix(in srgb, var(--border) 60%, transparent)", "primitive-ring": "color-mix(in srgb, var(--foreground) 45%, transparent)", "primitive-text-secondary": "color-mix(in srgb, var(--foreground) 72%, transparent)", "primitive-text-placeholder": "color-mix(in srgb, var(--muted-foreground) 85%, transparent)", "primitive-radius": "0.75rem", "primitive-font-sans": "var(--font-sans)", "primitive-font-display": "var(--font-display)", "primitive-font-mono": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", "primitive-control-solid": "#24292d", "primitive-control-solid-hover": "#2c3237", "primitive-control-solid-active": "#1e2326", "primitive-control-solid-foreground": "#ffffff", "primitive-chart-1": "#2a78d6", "primitive-chart-2": "#1baf7a", "primitive-chart-3": "#eda100", "primitive-chart-4": "#008300", "primitive-chart-5": "#4a3aa7", "primitive-chart-6": "#e34948", "primitive-text-inverse": "#ffffff", "primitive-text-hint": "0.6875rem", "primitive-destructive": "#dc2626", "primitive-destructive-hover": "#b91c1c", "primitive-destructive-active": "#991b1b", "primitive-destructive-foreground": "#ffffff", "primitive-destructive-surface": "rgba(220, 38, 38, 0.10)", "primitive-destructive-border": "rgba(220, 38, 38, 0.45)", "primitive-success": "#047857", "primitive-success-surface": "rgba(4, 120, 87, 0.10)", "primitive-success-border": "rgba(4, 120, 87, 0.45)", "primitive-warning": "#b45309", "primitive-warning-surface": "rgba(180, 83, 9, 0.10)", "primitive-warning-border": "rgba(180, 83, 9, 0.45)", "primitive-info": "#0369a1", "primitive-info-surface": "rgba(3, 105, 161, 0.10)", "primitive-info-border": "rgba(3, 105, 161, 0.45)", "primitive-radius-control": "var(--primitive-radius)", "primitive-radius-control-sm": "min(calc(var(--primitive-radius) * 0.8), 12px)", "primitive-radius-surface": "calc(var(--primitive-radius) * 1.4)", "primitive-radius-popup": "var(--primitive-radius)", "primitive-radius-item": "calc(var(--primitive-radius) * 0.8)", "primitive-control-height-sm": "2rem", "primitive-control-height-md": "2.25rem", "primitive-control-height-lg": "2.5rem", "primitive-shadow-raised": "0 1px 1px -0.5px rgba(10, 10, 10, 0.08), 0 2px 6px -2px rgba(10, 10, 10, 0.08)", "primitive-shadow-overlay": "0 2px 4px -1px rgba(10, 10, 10, 0.06), 0 8px 16px -4px rgba(10, 10, 10, 0.08), 0 16px 32px -8px rgba(10, 10, 10, 0.14)", "primitive-shadow-modal": "0 4px 8px -2px rgba(10, 10, 10, 0.06), 0 16px 32px -8px rgba(10, 10, 10, 0.12), 0 32px 64px -16px rgba(10, 10, 10, 0.2)", "primitive-edge": "rgba(10, 10, 10, 0.1)", "primitive-catchlight": "rgba(10, 10, 10, 0.06)", "primitive-groove-shadow": "rgba(10, 10, 10, 0.08)", "primitive-groove-highlight": "rgba(255, 255, 255, 0.85)", "primitive-shadow-drop": "0 1px 1px -0.5px rgba(10, 10, 10, 0.1), 0 2px 4px -1px rgba(10, 10, 10, 0.06)", "primitive-shadow-recess": "inset 0 2px 3px -1px rgba(10, 10, 10, 0.1)", "primitive-control-face": "var(--primitive-surface-elevated)", "primitive-field-face": "var(--primitive-surface-elevated)", "primitive-well": "rgba(10, 10, 10, 0.045)", "primitive-shadow-well": "inset 0 1px 2px 0 rgba(10, 10, 10, 0.06)", "primitive-tint-hover": "rgba(10, 10, 10, 0.045)", "primitive-tint-press": "rgba(10, 10, 10, 0.06)", "primitive-footer": "color-mix(in srgb, var(--primitive-surface-elevated) 97%, black)", "primitive-overlay-face": "var(--primitive-surface-overlay)", "primitive-frame-face": "color-mix(in srgb, var(--primitive-surface-elevated) 97%, black)", "primitive-z-overlay": "100", "primitive-z-popover": "130", "primitive-z-toast": "140", "primitive-backdrop": "rgba(0, 0, 0, 0.6)", "primitive-motion-fast": "80ms", "primitive-motion-fast-exit": "60ms", "primitive-motion-moderate": "160ms", "primitive-motion-moderate-exit": "120ms", "primitive-motion-slow": "240ms", "primitive-motion-slow-exit": "160ms", "primitive-ease": "cubic-bezier(0.23, 1, 0.32, 1)" }, "dark": { "background": "#0a0a0b", "foreground": "#f5f5f6", "surface": "#111113", "surface-muted": "#18181b", "border": "rgba(255, 255, 255, 0.08)", "border-strong": "rgba(255, 255, 255, 0.14)", "muted": "#1c1c1f", "muted-foreground": "#a1a1aa", "ring": "#cd1c18", "pattern-fg": "rgba(255, 255, 255, 0.06)", "llb-primary": "#f5f5f6", "llb-primary-fg": "#0a0a0b", "llb-success": "#2da44e", "llb-error": "#f85149", "primitive-surface-elevated": "#0f0f10", "primitive-surface-overlay": "#141415", "primitive-surface-hover": "color-mix(in srgb, var(--foreground) 5%, transparent)", "primitive-surface-active": "color-mix(in srgb, var(--foreground) 10%, transparent)", "primitive-surface-selected": "color-mix(in srgb, var(--foreground) 8%, transparent)", "primitive-border-subtle": "color-mix(in srgb, var(--border) 60%, transparent)", "primitive-ring": "color-mix(in srgb, var(--foreground) 45%, transparent)", "primitive-text-secondary": "color-mix(in srgb, var(--foreground) 72%, transparent)", "primitive-text-placeholder": "color-mix(in srgb, var(--muted-foreground) 85%, transparent)", "primitive-radius": "0.75rem", "primitive-font-sans": "var(--font-sans)", "primitive-font-display": "var(--font-display)", "primitive-font-mono": "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace", "primitive-control-solid": "#f5f3ee", "primitive-control-solid-hover": "#ffffff", "primitive-control-solid-active": "#e8e4da", "primitive-control-solid-foreground": "#151719", "primitive-chart-1": "#3987e5", "primitive-chart-2": "#199e70", "primitive-chart-3": "#c98500", "primitive-chart-4": "#008300", "primitive-chart-5": "#9085e9", "primitive-chart-6": "#e66767", "primitive-text-inverse": "#151719", "primitive-text-hint": "0.6875rem", "primitive-destructive": "#e11d2e", "primitive-destructive-hover": "#c1121f", "primitive-destructive-active": "#a4161a", "primitive-destructive-foreground": "#ffffff", "primitive-destructive-surface": "rgba(225, 29, 46, 0.12)", "primitive-destructive-border": "rgba(225, 29, 46, 0.52)", "primitive-success": "#34d399", "primitive-success-surface": "rgba(52, 211, 153, 0.12)", "primitive-success-border": "rgba(52, 211, 153, 0.45)", "primitive-warning": "#fbbf24", "primitive-warning-surface": "rgba(251, 191, 36, 0.12)", "primitive-warning-border": "rgba(251, 191, 36, 0.45)", "primitive-info": "#38bdf8", "primitive-info-surface": "rgba(56, 189, 248, 0.12)", "primitive-info-border": "rgba(56, 189, 248, 0.45)", "primitive-radius-control": "var(--primitive-radius)", "primitive-radius-control-sm": "min(calc(var(--primitive-radius) * 0.8), 12px)", "primitive-radius-surface": "calc(var(--primitive-radius) * 1.4)", "primitive-radius-popup": "var(--primitive-radius)", "primitive-radius-item": "calc(var(--primitive-radius) * 0.8)", "primitive-control-height-sm": "2rem", "primitive-control-height-md": "2.25rem", "primitive-control-height-lg": "2.5rem", "primitive-shadow-raised": "inset 0 1px 0 0 rgba(255, 255, 255, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.6), 0 2px 6px -2px rgba(0, 0, 0, 0.5)", "primitive-shadow-overlay": "inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 8px 16px -4px rgba(0, 0, 0, 0.45), 0 16px 32px -8px rgba(0, 0, 0, 0.65)", "primitive-shadow-modal": "inset 0 1px 0 0 rgba(255, 255, 255, 0.06), 0 4px 8px -2px rgba(0, 0, 0, 0.4), 0 16px 32px -8px rgba(0, 0, 0, 0.55), 0 32px 64px -16px rgba(0, 0, 0, 0.75)", "primitive-edge": "rgba(255, 255, 255, 0.09)", "primitive-catchlight": "rgba(255, 255, 255, 0.16)", "primitive-groove-shadow": "rgba(0, 0, 0, 0.55)", "primitive-groove-highlight": "rgba(255, 255, 255, 0.05)", "primitive-shadow-drop": "0 1px 1px -0.5px rgba(0, 0, 0, 0.6), 0 2px 4px -1px rgba(0, 0, 0, 0.4)", "primitive-shadow-recess": "inset 0 2px 3px -1px rgba(0, 0, 0, 0.5)", "primitive-control-face": "var(--primitive-frame-face)", "primitive-field-face": "var(--primitive-frame-face)", "primitive-well": "rgba(0, 0, 0, 0.35)", "primitive-shadow-well": "inset 0 1px 2px 0 rgba(0, 0, 0, 0.45)", "primitive-tint-hover": "rgba(255, 255, 255, 0.06)", "primitive-tint-press": "rgba(0, 0, 0, 0.2)", "primitive-footer": "color-mix(in srgb, var(--primitive-surface-elevated) 97%, white)", "primitive-overlay-face": "color-mix(in srgb, var(--primitive-surface-overlay) 94%, white)", "primitive-frame-face": "color-mix(in srgb, var(--primitive-surface-elevated) 97%, white)", "primitive-z-overlay": "100", "primitive-z-popover": "130", "primitive-z-toast": "140", "primitive-backdrop": "rgba(0, 0, 0, 0.6)", "primitive-motion-fast": "80ms", "primitive-motion-fast-exit": "60ms", "primitive-motion-moderate": "160ms", "primitive-motion-moderate-exit": "120ms", "primitive-motion-slow": "240ms", "primitive-motion-slow-exit": "160ms", "primitive-ease": "cubic-bezier(0.23, 1, 0.32, 1)" } }, "css": { "@layer components": { "[data-surface]": { "--surface-tint": "transparent", "border-width": "1px", "border-style": "solid", "border-color": "var(--surface-rim)", "border-top-color": "var(--surface-rim-top)", "background-color": "var(--surface-face)", "background-image": "linear-gradient(var(--surface-tint), var(--surface-tint))", "--tw-shadow": "var(--surface-depth)", "box-shadow": "var(--tw-inset-shadow, 0 0 #0000), var(--tw-inset-ring-shadow, 0 0 #0000), var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)" }, "[data-surface=\"control\"]": { "--surface-face": "var(--primitive-control-face)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-catchlight)", "--surface-depth": "var(--primitive-shadow-drop)" }, "[data-surface=\"field\"]": { "--surface-face": "var(--primitive-field-face)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-catchlight)", "--surface-depth": "var(--primitive-shadow-drop)" }, "[data-surface=\"fill\"]": { "--surface-face": "var(--primitive-control-solid)", "--surface-rim": "color-mix(in srgb, var(--surface-face) 88%, black)", "--surface-rim-top": "color-mix(in srgb, var(--surface-face) 80%, white)", "--surface-depth": "var(--primitive-shadow-drop)" }, "[data-surface=\"flat\"], [data-surface=\"toggle\"], [data-surface=\"toggle-fill\"]": { "--surface-face": "transparent", "--surface-rim": "transparent", "--surface-rim-top": "transparent", "--surface-depth": "0 0 #0000" }, "[data-surface=\"toggle\"]:is([data-pressed]:not([data-pressed=\"false\"]), [aria-pressed=\"true\"])": { "--surface-face": "var(--primitive-control-face)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-catchlight)", "--surface-depth": "var(--primitive-shadow-drop)" }, "[data-surface=\"toggle-fill\"]:is([data-pressed]:not([data-pressed=\"false\"]), [aria-pressed=\"true\"])": { "--surface-face": "var(--primitive-control-solid)", "--surface-rim": "color-mix(in srgb, var(--surface-face) 88%, black)", "--surface-rim-top": "color-mix(in srgb, var(--surface-face) 80%, white)", "--surface-depth": "var(--primitive-shadow-drop)" }, "[data-surface=\"well\"]": { "--surface-face": "var(--primitive-well)", "--surface-rim": "transparent", "--surface-rim-top": "transparent", "--surface-depth": "var(--primitive-shadow-well)" }, "[data-surface=\"frame\"]": { "--surface-face": "var(--primitive-frame-face)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-catchlight)", "--surface-depth": "0 0 #0000" }, "[data-surface=\"panel\"]": { "--surface-face": "var(--primitive-surface-elevated)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-edge)", "--surface-depth": "var(--primitive-shadow-raised)" }, "[data-surface=\"overlay\"]": { "--surface-face": "var(--primitive-overlay-face)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-edge)", "--surface-depth": "var(--primitive-shadow-overlay)" }, "[data-surface=\"modal\"]": { "--surface-face": "var(--primitive-surface-elevated)", "--surface-rim": "var(--primitive-edge)", "--surface-rim-top": "var(--primitive-edge)", "--surface-depth": "var(--primitive-shadow-modal)" }, "[data-surface=\"footer\"]": { "--surface-face": "var(--primitive-footer)", "--surface-rim": "transparent", "--surface-rim-top": "transparent", "--surface-depth": "0 0 #0000", "border-width": "0", "background-image": "linear-gradient(to bottom, var(--primitive-groove-shadow) 0 1px, var(--primitive-groove-highlight) 1px 2px)", "background-size": "100% 2px", "background-repeat": "no-repeat", "background-position": "top" }, "@media (hover: hover)": { "[data-surface]:where(button, a[href], summary, label, [role=\"button\"], [role=\"tab\"], [role=\"combobox\"], [role=\"option\"], [role=\"menuitem\"]):where(:not(:disabled, [data-disabled], [aria-disabled=\"true\"])):hover": { "--surface-tint": "var(--primitive-tint-hover)" }, ":is([data-surface=\"control\"], [data-surface=\"field\"]):is([data-pressed]:not([data-pressed=\"false\"]), [aria-pressed=\"true\"]):where(:not(:disabled, [data-disabled], [aria-disabled=\"true\"])):hover": { "--surface-tint": "var(--primitive-tint-hover)" } }, ":is([data-surface=\"control\"], [data-surface=\"field\"]):is([data-pressed]:not([data-pressed=\"false\"]), [aria-pressed=\"true\"])": { "--surface-tint": "var(--primitive-tint-press)", "--surface-rim-top": "var(--surface-rim)", "--surface-depth": "var(--primitive-shadow-recess)" }, ":is([data-surface=\"control\"], [data-surface=\"field\"], [data-surface=\"fill\"], [data-surface=\"toggle\"], [data-surface=\"toggle-fill\"]):is([aria-expanded=\"true\"], [data-popup-open]):not(input, textarea)": { "--surface-tint": "var(--primitive-tint-press)", "--surface-rim-top": "var(--surface-rim)", "--surface-depth": "var(--primitive-shadow-recess)" }, ":is([data-surface=\"control\"], [data-surface=\"field\"], [data-surface=\"fill\"], [data-surface=\"toggle\"], [data-surface=\"toggle-fill\"]):where(button, a[href], summary, [role=\"button\"], [role=\"tab\"]):where(:not(:disabled, [data-disabled], [aria-disabled=\"true\"])):active": { "--surface-tint": "var(--primitive-tint-press)", "--surface-rim-top": "var(--surface-rim)", "--surface-depth": "var(--primitive-shadow-recess)" }, "[data-surface=\"flat\"]:where(button, a[href], summary, [role=\"button\"], [role=\"tab\"]):where(:not(:disabled, [data-disabled], [aria-disabled=\"true\"])):active": { "--surface-tint": "var(--primitive-tint-press)" }, "[data-surface]:is([aria-invalid=\"true\"], :has(> :is(input, textarea)[aria-invalid=\"true\"]))": { "--surface-rim": "var(--primitive-destructive-border)", "--surface-rim-top": "var(--primitive-destructive-border)" }, "[data-surface][data-surface]:is(:disabled, [data-disabled], [aria-disabled=\"true\"])": { "--surface-tint": "transparent", "--surface-rim-top": "var(--surface-rim)", "--surface-depth": "0 0 #0000" }, "[data-groove]": { "flex-shrink": "0", "border-width": "0", "background-image": "linear-gradient(var(--groove-direction, to bottom), var(--primitive-groove-shadow) 0 1px, var(--primitive-groove-highlight) 1px 2px)" }, "[data-groove=\"horizontal\"]": { "height": "2px" }, "[data-groove=\"vertical\"]": { "--groove-direction": "to right", "width": "2px", "align-self": "stretch" }, "[data-carve]": { "background-image": "linear-gradient(to bottom, var(--primitive-groove-shadow) 0 1px, var(--primitive-groove-highlight) 1px 2px)", "background-repeat": "no-repeat", "background-size": "100% 2px" }, "[data-carve=\"top\"]": { "background-position": "top" }, "[data-carve=\"bottom\"]": { "background-position": "bottom" } }, "@layer base": { ":where([data-wensity-primitive])": { "font-family": "var(--primitive-font-sans)" } }, "@utility scrollbar-hidden": { "scrollbar-width": "none", "-ms-overflow-style": "none", "&::-webkit-scrollbar": { "display": "none" } }, "@keyframes wensity-marquee-x": { "from": { "transform": "translate3d(0, 0, 0)" }, "to": { "transform": "translate3d(-50%, 0, 0)" } }, "@keyframes wensity-marquee-x-reverse": { "from": { "transform": "translate3d(-50%, 0, 0)" }, "to": { "transform": "translate3d(0, 0, 0)" } }, "@keyframes wensity-morph-rot-cw": { "from": { "transform": "rotate(0deg)" }, "to": { "transform": "rotate(360deg)" } }, "@keyframes wensity-morph-rot-ccw": { "from": { "transform": "rotate(0deg)" }, "to": { "transform": "rotate(-360deg)" } } }, "docs": "Free Wensity component. Installs to @components/wensity/navigation-menu.tsx. For Pro components and updates, use pnpm dlx wensity@latest add navigation-menu.", "categories": [ "UI Primitives", "wensity", "free" ], "meta": { "wensity": { "slug": "navigation-menu", "access": "free", "category": "UI Primitives", "kind": "component", "componentUrl": "https://ui.wensity.com/primitives/navigation-menu", "shadcnUrl": "https://ui.wensity.com/r/navigation-menu", "cliInstall": "pnpm dlx wensity@latest add navigation-menu" } } }