Free
Pro

Context Menu

A right-click menu that opens at the pointer. Attach [ply-context-menu-trigger] to any host, then define items inside <ply-context-menu>. Also opens with Shift+F10 or the Context Menu key when the host is focused.

free

Basic

Right-click the surface below (or focus it and press Shift+F10).

File list

Each row can bind its own menu. Useful for file managers, tables, and lists.

HTML

<ul>
  @for (file of files; track file.id) {
    <li
      tabindex="0"
      [ply-context-menu-trigger]="fileMenu"
      (contextmenu)="setActiveFile(file)"
      (keydown.shift.f10)="setActiveFile(file)">
      {{ file.name }}
    </li>
  }
</ul>

<ply-context-menu #fileMenu>
  <button ply-context-menu-item type="button" (click)="runOnFile('Open')">Open</button>
  <button ply-context-menu-item type="button" (click)="runOnFile('Rename')">Rename</button>
  <button ply-context-menu-item type="button" (click)="runOnFile('Delete')">Delete</button>
</ply-context-menu>

TypeScript

readonly files = [
  { id: 1, name: 'Brand guidelines.pdf', kind: 'PDF' },
  { id: 2, name: 'Hero mockup.png', kind: 'Image' },
];

activeFile: { id: number; name: string; kind: string } | null = null;

setActiveFile(file: typeof this.files[number]): void {
  this.activeFile = file;
}

runOnFile(action: string): void {
  console.log(action, this.activeFile?.name);
}

Installation

Run the following command to add this component to your project:

bash

npx ply-ui-cli add context-menu

API Reference

For AI agents

Copy a prompt with the registry name, CLI install, and import — or add the Ply MCP server.

bash

npx -y ply-ui-mcp

Ply provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

// Install: npx ply-ui-cli add context-menu
// Paths are relative to aliases.components (default: src/app/components)
import { ContextMenuPanel } from './context-menu/context-menu-panel';
import { ContextMenuComponent } from './context-menu/context-menu.component';
import { ContextMenuDirective } from './context-menu/context-menu.directive';

@Component({
  selector: 'app-your-component',
  imports: [
    ContextMenuComponent,
    ContextMenuDirective
  ],
  template: `...`
})
export class YourComponent {}

API for context-menu — generated from JSDoc in the library source.

API reference for context-menu
APIMemberTypeDefaultDescription
ContextMenuPaneltemplateRefSignal<TemplateRef<T>>
ContextMenuPanelclosedOutputEmitterRef<void>
ply-context-menusizestringOptional custom width for the context menu container.
ply-context-menu(closed)voidEmitted when the menu should close (Escape, Tab, or after an item is chosen).
[ply-context-menu-trigger]ply-context-menu-triggerContextMenuPanel<T>(required)The reference to the `ply-context-menu` component to open.
[ply-context-menu-trigger]disabledbooleanfalseWhen true, the native browser context menu is not suppressed and the Ply menu will not open.