Navigated to /docs/ui/components/navigation-menu

NavigationMenu

Horizontal or vertical destination list with current-page semantics.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.

TSX
tsximport { NavigationMenu } from "@tavojs/ui/navigation-menu";

The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/navigation-menu.

When to use

Use it when

Use NavigationMenu for persistent links between product or documentation sections, usually inside AppBar or Sidebar.

Choose something else when

Use DropdownMenu for contextual commands, Tabs for switching panels without navigation, and ToggleGroup for choosing a value.

Examples

These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.

NavigationMenu example

TSXCreate: src/components/examples/NavigationMenuExample1.tsx
tsximport { NavigationMenu } from "@tavojs/ui/navigation-menu";

export function NavigationMenuExample1() {
  return (
    <>
      <NavigationMenu items={[{ label: "Overview", href: "/", current: true }, { label: "Settings", href: "/settings" }]} />
    </>
  );
}

Common props and defaults

A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
itemsArray

Navigation items when supported by the component. Applies to NavigationMenu.
aria-labelstring

Accessible label for navigation landmarks when needed. Applies to NavigationMenu.
childrenChild

Navigation content or custom item structure. Applies to NavigationMenu.

Complete TypeScript API

Import from @tavojs/ui/navigation-menu. Published exports: NavigationMenu, NavigationMenuItem, NavigationMenuProps.

NavigationMenuProps

PropertyTypeRequiredDescription
childrenChild

No

Navigation content or custom item structure. Applies to NavigationMenu.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by NavigationMenu.

idstring

No

Inherited id attribute accepted by NavigationMenu.

rolestring

No

Inherited role attribute accepted by NavigationMenu.

styleRecord<string, unknown>

No

Inherited style attribute accepted by NavigationMenu.

titlestring

No

Inherited title attribute accepted by NavigationMenu.

tabIndexnumber

No

Inherited tabIndex attribute accepted by NavigationMenu.

hiddenboolean

No

Inherited hidden attribute accepted by NavigationMenu.

disabledboolean

No

Inherited disabled attribute accepted by NavigationMenu.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by NavigationMenu.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by NavigationMenu.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by NavigationMenu.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by NavigationMenu.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by NavigationMenu.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by NavigationMenu.

itemsNavigationMenuItem[]

No

Navigation items when supported by the component. Applies to NavigationMenu.

orientation"horizontal" | "vertical"

No

Inherited orientation attribute accepted by NavigationMenu.

State ownership and DOM target

ConcernContract
StateNo component state contract is exposed; the application owns the rendered content and surrounding behavior.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Use DropdownMenu for contextual commands, Tabs for switching panels without navigation, and ToggleGroup for choosing a value.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Navigation components should expose current-page state and landmark labels when context is not obvious.

  • Use aria-current for active destinations where supported.

  • Add aria-label when multiple nav landmarks exist.

  • Keep link text descriptive.

Component status

ContractCurrent value
Maturitystable
Categorynavigation
Component import@tavojs/ui/navigation-menu
Explicit CSS import@tavojs/ui/css/navigation-menu
PreviewInteractive preview available on this page