Right-click floating menu — powered by use:floating (@floating-ui/dom) via virtual cursor anchor
Keyboard: focus moves to the first item on open — ArrowUp/ArrowDown/Home/End to move, Enter/Space to activate, Escape to dismiss.
Items may carry a nested submenu array — a right-side popover
opens on hover / focus / ArrowRight; a chevron indicates the nesting.
ArrowLeft or Escape closes just the submenu. Submenus nest arbitrarily.
An item may carry a content snippet that replaces the
default icon+label row. Use it for inline widgets — a segmented
toggle, a small input, a chip — that belong inside a menu row
without a bespoke shell. Widgets that should NOT close the menu
call event.stopPropagation() on their handlers.
Wraps any content with both a right-click handler and a small "⋯" button (hover/focus-visible on mouse, always shown on coarse/touch pointers) that opens the same menu. Use this instead of hand-rolling oncontextmenu on cards/rows that also need to work on touch.
The same primitive, anchored to a button element with flip + shift enabled. Dismiss via click-outside or Escape. Entrance: fade + 2 px rise.
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Menu visibility (bindable) |
x | number | 0 | Horizontal position in px (clientX) |
y | number | 0 | Vertical position in px (clientY) |
header | string | — | Optional header label above items |
items | MenuItem[] | [] | Menu items — label + onSelect, optional icon/variant/disabled/submenu/content, or divider: true |
zIndex | number | 70 | Stacking z-index |
onClose | () => void | — | Called after menu closes |
| Prop | Type | Default | Description |
|---|---|---|---|
items | ContextMenuItem[] | — | Forwarded to the underlying ContextMenu |
header | string | — | Forwarded to the underlying ContextMenu |
children | Snippet | — | Wrapped content |
triggerLabel | string | "More actions" | aria-label for the "⋯" button |
hideButton | boolean | false | Right-click only, no "⋯" button |
zIndex | number | 70 | Forwarded to the underlying ContextMenu |
class | string | — | Additional class on the wrapper element |