MenuNav
A versatile navigation menu component supporting vertical sidebars, horizontal navbars, nested submenus, collapsible groups, and toolbar mode.
Basic Usage
Vertical Menu
A simple vertical navigation menu with icons and a badge.
import { MenuNav } from 'fluxo-ui';
const items = [
{ id: 'home', label: 'Home', icon: <HomeIcon /> },
{ id: 'inbox', label: 'Inbox', icon: <InboxIcon />, badge: <Badge>5</Badge> },
{ id: 'documents', label: 'Documents', icon: <FileIcon /> },
{ id: 'analytics', label: 'Analytics', icon: <ChartIcon /> },
{ id: 'users', label: 'Users', icon: <UsersIcon /> },
{ id: 'settings', label: 'Settings', icon: <SettingsIcon /> },
];
<MenuNav
items={items}
defaultSelectedId="home"
onSelect={(id, item) => console.log(id, item)}
/>Horizontal
Set orientation="horizontal" for a top navigation bar with dropdown submenus.
Horizontal Menu
A horizontal navigation bar with dropdown submenus.
import { MenuNav } from 'fluxo-ui';
<MenuNav
items={items}
orientation="horizontal"
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>Selection Styles
Use selectionStyle to change how the active item is visually indicated.
Selection Styles
Five different visual styles for the selected menu item.
Border Left
Border Bottom
Background
Arrow
Highlight
import { MenuNav } from 'fluxo-ui';
import type { MenuNavSelectionStyle } from 'fluxo-ui';
<MenuNav
items={items}
selectionStyle="border-left"
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>
<MenuNav
items={items}
selectionStyle="background"
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>
<MenuNav
items={items}
selectionStyle="arrow"
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>
<MenuNav
items={items}
selectionStyle="highlight"
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>Sizes
The size prop controls the overall scale of menu items.
Size Variants
The menu supports five size options from extra small to extra large.
Extra Small (xs)
Small (sm)
Medium (md)
Large (lg)
Extra Large (xl)
import { MenuNav } from 'fluxo-ui';
<MenuNav items={items} size="xs" />
<MenuNav items={items} size="sm" />
<MenuNav items={items} size="md" />
<MenuNav items={items} size="lg" />
<MenuNav items={items} size="xl" />Collapsible
Enable collapsible to allow toggling between full and icon-only mode.
Collapsible Sidebar
Toggle between full and icon-only mode. Click the hamburger icon to collapse/expand.
Selected: home
Collapsed: No
import { MenuNav } from 'fluxo-ui';
const [collapsed, setCollapsed] = useState(false);
<MenuNav
items={items}
collapsible
collapsed={collapsed}
onCollapsedChange={setCollapsed}
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>Toolbar Mode
Set toolbar for an application-style menu bar with dropdown items.
Toolbar Mode
A horizontal toolbar-style menu, typical of application menu bars.
import { MenuNav } from 'fluxo-ui';
const items = [
{ id: 'file', label: 'File', children: [
{ id: 'new', label: 'New' },
{ id: 'open', label: 'Open' },
{ id: 'save', label: 'Save' },
]},
{ id: 'edit', label: 'Edit', children: [
{ id: 'undo', label: 'Undo' },
{ id: 'redo', label: 'Redo' },
{ id: 'copy', label: 'Copy' },
]},
{ id: 'view', label: 'View', children: [
{ id: 'zoom-in', label: 'Zoom In' },
{ id: 'zoom-out', label: 'Zoom Out' },
]},
{ id: 'help', label: 'Help', children: [
{ id: 'docs', label: 'Documentation' },
{ id: 'about', label: 'About' },
]},
];
<MenuNav
items={items}
toolbar
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>Custom Slots
Use headerSlot, footerSlot, and showSearch to add custom content around the menu.
Header, Footer & Search
Custom header and footer slots with built-in search functionality.
import { MenuNav } from 'fluxo-ui';
<MenuNav
items={items}
showSearch
searchPlaceholder="Search menu..."
headerSlot={
<div style={{ padding: '12px 16px', borderBottom: '1px solid var(--eui-border)' }}>
<div style={{ fontWeight: 600, fontSize: '14px' }}>Acme Inc.</div>
<div style={{ fontSize: '12px', opacity: 0.6 }}>Workspace</div>
</div>
}
footerSlot={
<div style={{ padding: '12px 16px', borderTop: '1px solid var(--eui-border)', display: 'flex', alignItems: 'center', gap: '8px' }}>
<div style={{ width: 32, height: 32, borderRadius: '50%', background: 'var(--eui-primary)', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: '13px', fontWeight: 600 }}>JD</div>
<div>
<div style={{ fontSize: '13px', fontWeight: 500 }}>John Doe</div>
<div style={{ fontSize: '11px', opacity: 0.6 }}>john@acme.com</div>
</div>
</div>
}
selectedId={selectedId}
onSelect={(id) => setSelectedId(id)}
/>Import
import { MenuNav } from 'fluxo-ui';
import type { MenuNavProps, MenuNavItem, MenuNavGroup, MenuNavSize, MenuNavSelectionStyle } from 'fluxo-ui';Props
itemsreq(MenuNavItem | MenuNavGroup)[]Array of menu items or groups to render.
itemsreq(MenuNavItem | MenuNavGroup)[]Array of menu items or groups to render.
orientation'vertical' | 'horizontal'"'vertical'"Layout orientation of the menu.
orientation'vertical' | 'horizontal'"'vertical'"Layout orientation of the menu.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"'md'"Size of menu items.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"'md'"Size of menu items.
selectedIdstringControlled selected item ID.
selectedIdstringControlled selected item ID.
defaultSelectedIdstring"''"Default selected item ID for uncontrolled usage.
defaultSelectedIdstring"''"Default selected item ID for uncontrolled usage.
onSelect(id: string, item: MenuNavItem) => voidCallback when a menu item is selected.
onSelect(id: string, item: MenuNavItem) => voidCallback when a menu item is selected.
selectionStyle'border-left' | 'border-bottom' | 'background' | 'arrow' | 'highlight'"'border-left'"Visual style for the selected item indicator.
selectionStyle'border-left' | 'border-bottom' | 'background' | 'arrow' | 'highlight'"'border-left'"Visual style for the selected item indicator.
iconPosition'left' | 'right'"'left'"Position of icons relative to label text.
iconPosition'left' | 'right'"'left'"Position of icons relative to label text.
collapsedbooleanControlled collapsed state (icon-only mode).
collapsedbooleanControlled collapsed state (icon-only mode).
collapsibleboolean"false"Whether the menu can be collapsed to icon-only mode.
collapsibleboolean"false"Whether the menu can be collapsed to icon-only mode.
onCollapsedChange(collapsed: boolean) => voidCallback when collapsed state changes.
onCollapsedChange(collapsed: boolean) => voidCallback when collapsed state changes.
mobileBreakpointnumber"768"Viewport width below which mobile mode activates.
mobileBreakpointnumber"768"Viewport width below which mobile mode activates.
mobileFullScreenboolean"true"Whether mobile menu takes full screen.
mobileFullScreenboolean"true"Whether mobile menu takes full screen.
showSearchboolean"false"Show a search input to filter menu items.
showSearchboolean"false"Show a search input to filter menu items.
searchPlaceholderstring"'Search...'"Placeholder text for the search input.
searchPlaceholderstring"'Search...'"Placeholder text for the search input.
searchAriaLabelstring"'Search navigation'"Accessible label for the search input (used for screen readers).
searchAriaLabelstring"'Search navigation'"Accessible label for the search input (used for screen readers).
headerSlotReactNodeCustom content rendered above the menu.
headerSlotReactNodeCustom content rendered above the menu.
footerSlotReactNodeCustom content rendered below the menu.
footerSlotReactNodeCustom content rendered below the menu.
maxSubMenuDepthnumber"3"Maximum depth of nested submenus.
maxSubMenuDepthnumber"3"Maximum depth of nested submenus.
toolbarboolean"false"Enable toolbar mode (horizontal with border-bottom selection).
toolbarboolean"false"Enable toolbar mode (horizontal with border-bottom selection).
classNamestringAdditional CSS class for the nav element.
classNamestringAdditional CSS class for the nav element.
ariaLabelstring"'Navigation'"ARIA label for the nav element.
ariaLabelstring"'Navigation'"ARIA label for the nav element.
Features
Dual Orientation
Vertical sidebar or horizontal navbar layout with automatic style adjustments.
Nested Submenus
Supports up to 3 levels of nested submenus with expand/collapse.
Selection Styles
Five distinct visual styles for highlighting the active menu item.
Collapsible Sidebar
Toggle between full menu and compact icon-only mode.
Grouped Items
Organize items into collapsible groups with section headers.
Mobile Responsive
Automatic mobile mode with fullscreen overlay and drill-down navigation.