Navigation

Menu

Vertical, horizontal, and collapsible navigation menu with nested sub-menus, icons, and disabled states.

Inline (vertical)

Collapsed (icons only)

Installation

npx benflux-ui add menu

Usage

import { Menu, type MenuItem } from "@benflux-ui/react"

const items: MenuItem[] = [
  { key: "home", label: "Home", icon: <Home /> },
  {
    key: "analytics",
    label: "Analytics",
    icon: <BarChart2 />,
    children: [
      { key: "overview", label: "Overview" },
      { key: "reports", label: "Reports" },
    ],
  },
  { key: "settings", label: "Settings", disabled: true },
]

<Menu
  items={items}
  selectedKey={selected}
  onSelect={setSelected}
  mode="inline"       // "inline" | "horizontal" | "vertical"
  collapsed={false}   // collapse to icons only
/>

Props

PropTypeDefaultDescription
items*MenuItem[]Array of menu item definitions
selectedKeystringKey of the currently active item
onSelect(key: string) => voidCallback when an item is clicked
mode"inline" | "horizontal" | "vertical""inline"Layout direction of the menu
collapsedbooleanfalseCollapse to icon-only mode (vertical inline only)
defaultOpenKeysstring[][]Keys of sub-menus open by default