jatui

ContextMenu

Right-click floating menu — powered by use:floating (@floating-ui/dom) via virtual cursor anchor

ContextMenu — right-click

Keyboard: focus moves to the first item on open — ArrowUp/ArrowDown/Home/End to move, Enter/Space to activate, Escape to dismiss.

Nested submenus

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.

Inline content — widget-inside-a-row

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.

ContextMenuTrigger — right-click + "⋯" touch affordance

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.

Card A — right-click or use "⋯"
Card B — right-click or use "⋯"

use:floating — element-anchored popover

The same primitive, anchored to a button element with flip + shift enabled. Dismiss via click-outside or Escape. Entrance: fade + 2 px rise.

Props

PropTypeDefaultDescription
openbooleanfalseMenu visibility (bindable)
xnumber0Horizontal position in px (clientX)
ynumber0Vertical position in px (clientY)
headerstringOptional header label above items
itemsMenuItem[][]Menu items — label + onSelect, optional icon/variant/disabled/submenu/content, or divider: true
zIndexnumber70Stacking z-index
onClose() => voidCalled after menu closes

ContextMenuTrigger props

PropTypeDefaultDescription
itemsContextMenuItem[]Forwarded to the underlying ContextMenu
headerstringForwarded to the underlying ContextMenu
childrenSnippetWrapped content
triggerLabelstring"More actions"aria-label for the "⋯" button
hideButtonbooleanfalseRight-click only, no "⋯" button
zIndexnumber70Forwarded to the underlying ContextMenu
classstringAdditional class on the wrapper element