Context Menu
A positioned floating menu triggered by right-click or button click. Mount <ContextMenuManager /> once at your app root, then call showContextMenu() from any event handler.
Setup
import { ContextMenuManager } from 'fluxo-ui';
function App() {
return (
<>
<ContextMenuManager />
{/* rest of app */}
</>
);
}Button-triggered Menu
Click button to open menu
Use onClick instead of onContextMenu for button-triggered menus.
<Button onClick={(e) => showContextMenu(e as React.MouseEvent, menuItems)}>
Open Menu
</Button>Import
import { ContextMenuManager, showContextMenu } from 'fluxo-ui';API Reference
ContextMenuManager
No props required—ContextMenuManager is a singleton. Mount it once at the app root; it manages all context menu state internally.
No props required—ContextMenuManager is a singleton. Mount it once at the app root; it manages all context menu state internally.
showContextMenu(event, menus, options?)
eventreqReact.MouseEventThe mouse event from onContextMenu or onClick. Used to position the menu.
eventreqReact.MouseEventThe mouse event from onContextMenu or onClick. Used to position the menu.
menusreqMenuItem[]Array of menu items to display.
menusreqMenuItem[]Array of menu items to display.
optionsContextMenuOptionsOptional configuration — currently supports placement (PlacementCorners).
optionsContextMenuOptionsOptional configuration — currently supports placement (PlacementCorners).
MenuItem
labelstringText shown for the menu item.
labelstringText shown for the menu item.
iconReactNodeOptional icon placed before the label.
iconReactNodeOptional icon placed before the label.
command(id?: any) => voidCallback invoked when the item is clicked.
command(id?: any) => voidCallback invoked when the item is clicked.
separatorbooleanWhen true, renders a visual divider instead of a clickable item.
separatorbooleanWhen true, renders a visual divider instead of a clickable item.
seperatorbooleanDeprecated. Misspelled alias for `separator` kept for backwards compatibility — prefer `separator` in new code.
seperatorbooleanDeprecated. Misspelled alias for `separator` kept for backwards compatibility — prefer `separator` in new code.
itemsMenuItemBase[]Nested sub-menu items (one level deep).
itemsMenuItemBase[]Nested sub-menu items (one level deep).
idanyOptional identifier passed to the command callback.
idanyOptional identifier passed to the command callback.
Features
Global Manager Pattern
Mount ContextMenuManager once at the app root and call showContextMenu() from any event handler — no prop drilling required.
Right-click & Click Trigger
Attach to onContextMenu for classic right-click behavior or to onClick for button-triggered dropdown-style menus.
Nested Sub-menus
Define items with an items array for one level of nested sub-menus that expand on hover — ideal for export or action groupings.
Scrollable Long Menus
Menus with many items automatically become scrollable with hover-triggered arrow controls — no scrollbar clutter.
Separators
Add visual dividers between menu groups by including an item with seperator: true to logically organize actions.
Icon Support
Each menu item supports an icon prop that accepts any ReactNode — use any icon component or custom SVG element.
Smart Viewport Positioning
The menu automatically repositions itself to stay within the viewport bounds regardless of where the right-click occurs.
Theming
Full dark/light mode and all 5 brand themes supported automatically via CSS custom properties.