SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

contextMenu

Opens a ContextMenu's popover surface at the pointer position when its host receives a right-click, anchoring it with @remix-run/ui/anchor's point-based positioning since no markup can anchor a floating surface to a pointer position.

tsx
import { contextMenu } from "@sdxc/ui/app";

Usage

Opens the popover surface identified by id at the pointer position on a contextmenu event, or the host's bounding box from the keyboard, since a popover="auto" surface already handles its own Escape/outside-click dismissal. A pointer's menu opens on the release of the press that asked for it, so the surface stays up until the next press rather than being dismissed by that same one.

Signature

typescript
contextMenu(id: string, options?: AnchorOptions): MixinDescriptor<HTMLElement>

Parameters

ParameterTypeDefaultRequiredDescription
idstring—Yesid of the popover surface to open.
optionsAnchorOptions—NoAnchor placement and offsets forwarded to @remix-run/ui/anchor; placement defaults to "bottom-start". Safe to omit — contextMenu(id) resets the runtime's trailing current-props argument back to an empty options object.

Examples

tsx
<div id="row-1" mix={contextMenu("row-1-menu")}>Row 1</div>
<div id="row-1-menu" popover="auto" role="menu">...</div>
@sdxc/ui

Can’t find it? Contact us