AsterUIDocsv1.0.2

Docs / Component reference

ContextMenu

Give an item its own menu of actions. Open the menu inside the example to see how it stays near the pointer.

Context menu example

Install

sh
npx @fierst/ui@1.0.2 add context-menu

Registry dependencies: theme.

Exports from ./ui/context-menu: ContextMenuItem, ContextMenu.

Download the registry source for context-menu 1.0.2.

API contracts

ts
export interface ContextMenuItem {
  id: string;
  label: string;
  shortcut?: string;
  danger?: boolean;
  disabled?: boolean;
  separatorBefore?: boolean;
  onSelect: () => void;
}

export function* ContextMenu(
  props: {
    items: readonly ContextMenuItem[];
    class?: string;
    children?: View;
  },
  ctx: Ctx,
)