NavigationMenu
Horizontal or vertical destination list with current-page semantics.
Preview
A live, theme-aware example rendered with the published component.
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { NavigationMenu } from "@tavojs/ui/navigation-menu";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/navigation-menu.
When to use
Use it when
Choose something else when
Examples
NavigationMenu example
tsximport { NavigationMenu } from "@tavojs/ui/navigation-menu";
export function NavigationMenuExample1() {
return (
<>
<NavigationMenu />
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
items | Array | — | Navigation items when supported by the component. Applies to NavigationMenu. |
aria-label | string | — | Accessible label for navigation landmarks when needed. Applies to NavigationMenu. |
children | Child | — | Navigation content or custom item structure. Applies to NavigationMenu. |
Complete TypeScript API
Import from @tavojs/ui/navigation-menu. Published exports: NavigationMenu, NavigationMenuItem, NavigationMenuProps.
NavigationMenuProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Navigation content or custom item structure. Applies to NavigationMenu. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by NavigationMenu. |
id | string | No | Inherited id attribute accepted by NavigationMenu. |
role | string | No | Inherited role attribute accepted by NavigationMenu. |
style | Record<string, unknown> | No | Inherited style attribute accepted by NavigationMenu. |
title | string | No | Inherited title attribute accepted by NavigationMenu. |
tabIndex | number | No | Inherited tabIndex attribute accepted by NavigationMenu. |
hidden | boolean | No | Inherited hidden attribute accepted by NavigationMenu. |
disabled | boolean | No | Inherited disabled attribute accepted by NavigationMenu. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by NavigationMenu. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by NavigationMenu. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by NavigationMenu. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by NavigationMenu. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by NavigationMenu. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by NavigationMenu. |
items | NavigationMenuItem[] | 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
| Concern | Contract |
|---|---|
| State | No component state contract is exposed; the application owns the rendered content and surrounding behavior. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
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
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | navigation |
| Component import | @tavojs/ui/navigation-menu |
| Explicit CSS import | @tavojs/ui/css/navigation-menu |
| Preview | Interactive preview available on this page |