NavigationMenu
overview
NavigationMenu is the stable styled menu-navigation primitive. Behavior is owned by `@uifn/core`; framework packages adapt that behavior and the styled packages add public parts and tokens. Implementation kind: `interactive-controller`.
anatomy
| Part | Public export | Native basis | Cardinality | Required value | React props | Svelte props | Solid props | |---|---|---|---|---|---|---|---| | `root` | `NavigationMenuRoot` | `nav` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `list` | `NavigationMenuList` | `ul` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `item` | `NavigationMenuItem` | `li` | many | `string` | `value: string`, `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `value: string`, `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `value: string`, `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `trigger` | `NavigationMenuTrigger` | `button` | many | `string` | `value: string`, `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `value: string`, `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `value: string`, `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `content` | `NavigationMenuContent` | `div` | many | `string` | `value: string`, `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `value: string`, `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `value: string`, `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `link` | `NavigationMenuLink` | `a` | many | `string` | `value: string`, `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `value: string`, `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `value: string`, `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `viewport` | `NavigationMenuViewport` | `div` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | | `indicator` | `NavigationMenuIndicator` | `div` | one | — | `native element props`, `className?: string`, `children?: ReactNode`, `asChild?: boolean`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` | `native element props`, `class?: string`, `children snippet`, `render snippet`, `forceMount?: boolean`, `container?: HTMLElement | null`, `bind:ref` | `native element props`, `class?: string`, `children?: JSX.Element`, `render?`, `forceMount?: boolean`, `container?: HTMLElement | null`, `ref` |
state-actions-parts
Controller and context ownership:
- Core: `@uifn/core/navigation-menu: createNavigationMenuController(props, environment?)`
- State: `NavigationMenuState`
- Actions: `NavigationMenuActions`
- Parts: `NavigationMenuController["parts"]`
- DOM owner: @uifn/dom owns root-scope-modality-tabbability, dismissable-layer, focus-scope, positioning-auto-update, portal-presence-transitions
- react context: `NavigationMenuProvider and useNavigationMenu(inputs); adapter context remains private`
- svelte context: `NavigationMenuProvider; adapter context remains private to compound descendants`
- solid context: `NavigationMenuProvider; adapter context remains private to compound descendants`
States:
- `idle` (semantic)
- `focused` (semantic)
- `open` (semantic)
Complete transition signatures:
- `{ type: "FOCUS_ITEM" }` — NavigationMenu semantic transition event FOCUS_ITEM. Source: controller-or-native-contract.
- `{ type: "OPEN_ITEM" }` — NavigationMenu semantic transition event OPEN_ITEM. Source: controller-or-native-contract.
- `{ type: "CLOSE_ITEM" }` — NavigationMenu semantic transition event CLOSE_ITEM. Source: controller-or-native-contract.
- `{ type: "NAVIGATE"; key: "ArrowDown" | "ArrowUp" | "ArrowLeft" | "ArrowRight" | "Home" | "End" }` — NavigationMenu semantic transition event NAVIGATE. Source: controller-or-native-contract.
- `{ type: "SELECT_LINK" }` — NavigationMenu semantic transition event SELECT_LINK. Source: controller-or-native-contract.
Controlled callbacks:
- `onValueChange(value: string) => void` — Called after NavigationMenu requests a value change. Controlled consumers must commit the value back through value.
Root inputs and defaults:
| Input | Type | Required | Reactive | Default | Description |
|---|---|---:|---:|---|---|
| `value` | `string` | no | yes | `undefined (uncontrolled)` | Optional reactive value input from the canonical NavigationMenu contract. |
| `defaultValue` | `string` | no | yes | `undefined → ""` | Optional reactive defaultValue input from the canonical NavigationMenu contract. |
| `orientation` | `string` | no | yes | `undefined (no public prop override)` | Optional reactive orientation input from the canonical NavigationMenu contract. |
| `delayDuration` | `number` | no | yes | `undefined (no public prop override)` | Optional reactive delayDuration input from the canonical NavigationMenu contract. |
| `skipDelayDuration` | `number` | no | yes | `undefined (no public prop override)` | Optional reactive skipDelayDuration input from the canonical NavigationMenu contract. |
| `dir` | `string` | no | yes | `undefined → "ltr"` | Optional reactive dir input from the canonical NavigationMenu contract. |controlled-uncontrolled
Control mode: `single`. Controlled inputs: `value`. Uncontrolled defaults: `defaultValue`. Change events: `VALUE_CHANGE`. Do not switch mode after mount.
accessibility
Profile: `menu-navigation`. Native semantic basis: Choose the primitive-specific menu, tab, toolbar, navigation, pagination, or tree model. Accessible name required: yes; accepted sources: visible-label, aria-label, aria-labelledby. WCAG mapping: 1.3.1, 2.1.1, 2.1.2, 2.4.3, 2.4.7, 2.4.11, 2.5.7, 4.1.2. Normative basis: native-html, wai-aria-apg-menu, wai-aria-apg-tabs, wai-aria-apg-treeview. Final manual accessibility review remains outstanding. Automated and current manual evidence does not include JAWS, which remains explicitly user-deferred.
keyboard-pointer-touch
Keyboard model: `primitive-specific-navigation`; keys: `Tab`, `Shift+Tab`, `ArrowDown`, `ArrowUp`, `ArrowLeft`, `ArrowRight`, `Home`, `End`, `Enter`, `Space`, `Escape`, `typeahead`. Pointer/touch obligations: item-activation, submenu-pointer-grace-where-applicable, contextmenu-where-applicable. Focus obligations: roving-tabindex-or-activedescendant, deterministic-focus-repair, restore-focus.
forms
Participation: `none`; value shape: `none`; reset: `none`; validation: `none`.
direction-locale
RTL contract: Declare logical versus physical direction behavior and mirror only directional semantics. Direction is supplied through DOM `dir`; locale-sensitive labels and formatting stay application-owned unless a primitive input says otherwise.
ssr-hydration
The controller is deterministic and DOM access is adapter-owned. Render the same controlled/default inputs on server and first client render. Portal, presence, root-scope, modality, and tabbability services (root-scope-modality-tabbability, dismissable-layer, focus-scope, positioning-auto-update, portal-presence-transitions) activate only after the DOM is available.
composition-styling
Use the compound root `NavigationMenu` or named parts shown above. Import `@uifn/components/styles.css` once, then override tokens or low-specificity part selectors in a later CSS layer. Stable data attributes: - `data-uifn-component="navigation-menu"` on all styled parts; stable. - `data-uifn-part="root | list | item | trigger | content | link | viewport | indicator"` on all styled parts; stable. - `data-state="idle | focused | open"` on stateful parts; stable semantic state. - `data-orientation="string"` on parts whose semantics depend on this input; stable semantic state. - `data-dir="string"` on parts whose semantics depend on this input; stable semantic state. CSS variables: - `--uifn-component-accent` (shared) - `--uifn-component-accent-contrast` (shared) - `--uifn-component-bg` (shared) - `--uifn-component-bg-muted` (shared) - `--uifn-component-border` (shared) - `--uifn-component-border-strong` (shared) - `--uifn-component-danger` (shared) - `--uifn-component-fg` (shared) - `--uifn-component-fg-muted` (shared) - `--uifn-component-radius-lg` (shared) - `--uifn-component-radius-md` (shared) - `--uifn-component-radius-sm` (shared) - `--uifn-component-shadow` (shared) - `--uifn-control-block-size` (shared) - `--uifn-control-gap` (shared)
package-install
Published package version: `0.0.1`; canonical catalog version: `stable-1.0`.
| Framework | Public import | Source-install target |
|---|---|---|
| react | `@uifn/components-react/navigation-menu` | `components/uifn/react/navigation-menu.ts` |
| svelte | `@uifn/components-svelte/navigation-menu` | `components/uifn/svelte/navigation-menu/index.ts` |
| solid | `@uifn/components-solid/navigation-menu` | `components/uifn/solid/navigation-menu.ts` |
#### React · package
```tsx
import * as React from 'react';
import { NavigationMenuRoot } from "@uifn/components-react/navigation-menu";
export function NavigationMenuExample() {
return React.createElement(NavigationMenuRoot, {"aria-label":"NavigationMenu example"});
}
```
#### React · source
```tsx
import * as React from 'react';
import { NavigationMenuRoot } from "./components/uifn/react/navigation-menu.js";
export function NavigationMenuExample() {
return React.createElement(NavigationMenuRoot, {"aria-label":"NavigationMenu example"});
}
```
#### Svelte · package
```svelte
<script lang="ts">
import { NavigationMenuRoot } from "@uifn/components-svelte/navigation-menu";
</script>
<NavigationMenuRoot aria-label="NavigationMenu example" />
```
#### Svelte · source
```svelte
<script lang="ts">
import { NavigationMenuRoot } from "./components/uifn/svelte/navigation-menu/index.js";
</script>
<NavigationMenuRoot aria-label="NavigationMenu example" />
```
#### Solid · package
```tsx
import { createComponent } from 'solid-js';
import { NavigationMenuRoot } from "@uifn/components-solid/navigation-menu";
export function NavigationMenuExample() {
return createComponent(NavigationMenuRoot, {"aria-label":"NavigationMenu example"});
}
```
#### Solid · source
```tsx
import { createComponent } from 'solid-js';
import { NavigationMenuRoot } from "./components/uifn/solid/navigation-menu.js";
export function NavigationMenuExample() {
return createComponent(NavigationMenuRoot, {"aria-label":"NavigationMenu example"});
}
```source-install
Use `uifn add navigation-menu --framework <react|svelte|solid>` through `@uifn/registry`. The lockfile records the catalog, generator, template, and output hashes. Source-install files have the same public component contract as package delivery; edit intentionally and let `uifn diff` report local divergence.
known-constraints
Required release channel: `stable-1.0`. Catalog status: `ga-required`. Compatibility certification is still pending external runner/device-lab evidence; this page documents current generated compatibility evidence and is not a complete release certification. Declared exceptions: none. Explicit limitations: - Controller state and actions are framework-neutral; focus, layers, portals, positioning, presence, and native form bridges activate through @uifn/dom after mount. - Apply the menu-navigation profile specifically to NavigationMenu; implementation vectors own exact behavior.