Navigation Menu Item
⋯
Navigation Menu Item renders the Figma Navigation Menu Item component: one item in a horizontal top
navigation. It renders a native button, or a link when you pass render. It is a single part. The
application owns the surrounding nav landmark, list, and routing.
import { NavigationMenuItem } from "@nesra/ui/navigation-menu-item";import { House } from "lucide-react";
export function OverviewLink() { return ( <NavigationMenuItem active render={<a aria-label="Overview" href="/overview" />} startIcon={<House />} > Overview </NavigationMenuItem> );}NavigationMenuItem is also exported from @nesra/ui.
import { NavigationMenuItem } from "@nesra/ui/navigation-menu-item";import { House } from "lucide-react";
export function NavigationMenuItemBasicExample() { return ( <NavigationMenuItem active render={<a aria-label="Overview" href="#overview" />} startIcon={<House />} > Overview </NavigationMenuItem> );}Examples
Section titled “Examples”Variants
Section titled “Variants”| Figma property | Code |
|---|---|
Variant=Icon |
startIcon |
Variant=Avatar |
avatar, with an Avatar at the default sm size |
Show Icon Left |
Set or omit startIcon |
Show Icon Right |
Set or omit endIcon |
Show Avatar |
Set or omit avatar |
Text Label |
children |
When both avatar and startIcon are set, only avatar renders.
import { Avatar } from "@nesra/ui/avatar";import { NavigationMenuItem } from "@nesra/ui/navigation-menu-item";import { ChevronDown, House } from "lucide-react";
export function NavigationMenuItemVariantsExample() { return ( <div className="flex flex-wrap items-center gap-nesra-spacing-lg"> <NavigationMenuItem endIcon={<ChevronDown />} startIcon={<House />}> Menu </NavigationMenuItem> <NavigationMenuItem avatar={<Avatar name="Jane Taylor" />} endIcon={<ChevronDown />}> Menu </NavigationMenuItem> <NavigationMenuItem>Menu</NavigationMenuItem> </div> );}States
Section titled “States”Figma State |
Code | Label | Outline |
|---|---|---|---|
Default |
— | Text/text-support |
none |
Hover |
pointer hover | Text/text-headline |
1px Stroke/stroke-border |
Active |
active |
Text/text-headline |
none until hovered |
Icons use Icon/icon-neutral in every Figma state. Keyboard focus shows Box Shadow/Focus ring offset and the headline label. Figma does not define focus or disabled states. The code adds them:
disabled sets Text/text-disabled and Icon/icon-disabled and blocks activation. Pass disabled to
an Avatar in the avatar slot as well.
import { Avatar } from "@nesra/ui/avatar";import { NavigationMenuItem } from "@nesra/ui/navigation-menu-item";import { ChevronDown, House } from "lucide-react";
export function NavigationMenuItemStatesExample() { return ( <div className="grid grid-cols-[auto_auto] items-center gap-nesra-spacing-lg"> <NavigationMenuItem endIcon={<ChevronDown />} startIcon={<House />}> Default </NavigationMenuItem> <NavigationMenuItem avatar={<Avatar name="Jane Taylor" />} endIcon={<ChevronDown />}> Default </NavigationMenuItem> <NavigationMenuItem active endIcon={<ChevronDown />} startIcon={<House />}> Active </NavigationMenuItem> <NavigationMenuItem active avatar={<Avatar name="Jane Taylor" />} endIcon={<ChevronDown />}> Active </NavigationMenuItem> <NavigationMenuItem disabled endIcon={<ChevronDown />} startIcon={<House />}> Disabled </NavigationMenuItem> <NavigationMenuItem avatar={<Avatar disabled name="Jane Taylor" />} disabled endIcon={<ChevronDown />} > Disabled </NavigationMenuItem> </div> );}Top navigation with menus
Section titled “Top navigation with menus”Wrap items in a nav landmark and a list. A Navigation Menu Item with a chevron can be the
render element of DropdownMenu.Trigger. While its menu is open, the label keeps the headline
color.
import { Avatar } from "@nesra/ui/avatar";import { DropdownMenu } from "@nesra/ui/dropdown-menu";import { NavigationMenuItem } from "@nesra/ui/navigation-menu-item";import { ChartColumn, ChevronDown, House, Settings } from "lucide-react";import { useState } from "react";
const destinations = [ { id: "overview", label: "Overview", icon: <House /> }, { id: "reports", label: "Reports", icon: <ChartColumn /> },];
export function NavigationMenuItemTopNavigationExample() { const [current, setCurrent] = useState("overview");
return ( <nav aria-label="Main" className="flex w-full items-center justify-between gap-nesra-spacing-lg border-b border-nesra-stroke-border bg-nesra-foundation-bg-neutral py-nesra-padding-xl" > <ul className="m-0 flex min-w-0 list-none items-center gap-nesra-spacing-xs overflow-x-auto p-0"> {destinations.map((destination) => ( <li key={destination.id}> <NavigationMenuItem active={current === destination.id} onClick={(event) => { event.preventDefault(); setCurrent(destination.id); }} render={<a aria-label={destination.label} href={`#${destination.id}`} />} startIcon={destination.icon} > {destination.label} </NavigationMenuItem> </li> ))} <li> <DropdownMenu> <DropdownMenu.Trigger render={<NavigationMenuItem endIcon={<ChevronDown />} startIcon={<Settings />} />} > Settings </DropdownMenu.Trigger> <DropdownMenu.Content align="start"> <DropdownMenu.Item>Workspace</DropdownMenu.Item> <DropdownMenu.Item>Members</DropdownMenu.Item> </DropdownMenu.Content> </DropdownMenu> </li> </ul> <DropdownMenu> <DropdownMenu.Trigger render={ <NavigationMenuItem avatar={<Avatar name="Jane Taylor" />} endIcon={<ChevronDown />} /> } > Jane Taylor </DropdownMenu.Trigger> <DropdownMenu.Content align="end"> <DropdownMenu.Item>Profile</DropdownMenu.Item> <DropdownMenu.Item>Sign out</DropdownMenu.Item> </DropdownMenu.Content> </DropdownMenu> </nav> );}Light and Dark
Section titled “Light and Dark”Navigation Menu Item follows the page theme. Dark applies when an ancestor has the dark class or
data-theme="dark". The item has no fill in either mode. It uses the semantic roles listed under
States.
Accessibility
Section titled “Accessibility”- Without
render, the item is a nativebutton. Withrender={<a href="…" />}, it is a link. The examples repeat the label as the anchor’saria-label, as the Sidebar examples do, so linting can confirm the link has a name. activesetsaria-current="page". Passaria-currentto use another value, such as"true"for a section.- Icons and the avatar are hidden from assistive technology.
childrenmust name the item. - Put items inside a
navwith an accessible name, such asaria-label="Main", and aul. Mark only one itemactiveper navigation. - Routing, link prefetching, and choosing the current item remain the application’s responsibility.
API reference
Section titled “API reference”| Prop | Type | Default | Description |
|---|---|---|---|
children |
ReactNode |
— | Label. Required to name the item. |
active |
boolean |
false |
Applies the Active state and sets aria-current="page". |
startIcon |
ReactNode |
— | 16px icon before the label. Hidden when avatar is set. |
endIcon |
ReactNode |
— | 16px icon after the label, such as a chevron for a menu trigger. |
avatar |
ReactNode |
— | 24px avatar before the label. Pass an Avatar at the default sm size. |
render |
ReactElement |
— | Element to render instead of a button, such as <a href="…" />. |
aria-current |
ARIA value | — | Overrides the value set by active. |
disabled |
boolean |
false |
Blocks activation and applies disabled colors. |
className |
string |
— | Adds or overrides classes. |
Other Base UI Button props are forwarded. A ref points to the rendered element. The type is
NavigationMenuItemProps.
The item is 36px tall with 16px horizontal padding, a 6px gap, an 8px radius, and Body/Small/Medium text. See Typography, Colors, and Avatar.