Context Menu Service for Angular | ngx-rightclick

ngx-rightclick is a multi-level, multi-target right-click context menu component for Angular 6+ applications.

context menu in angular, angular context menu example, angular material context menu right click, context menu directive angular, angular context menu event

Custom Multi-Level Context Menu with jQuery and CSS3

How to make use of it:


npm install @ctrl/ngx-rightclick

1. Import and add to NgModule.

import { ContextMenuModule } from '@ctrl/ngx-rightclick';

2. Add a context menu directive to the element and pass the menu component to be displayed.

// show.component.ts
  template: `
    <div [contextMenuTrigger]="menu" (menuAction)="handleMenuAction($event)">Right Click</div>
export class ShowComponent {
  // menu component imported and assigned locally
  menu = SimpleMenuComponent;
// my-menu.component.ts
import { Component } from '@angular/core';

import { MenuComponent, ContextMenuService, MenuPackage } from '@ctrl/ngx-rightclick';

  selector: 'simple-menu',
  // add your menu html
  template: `<a (click)="handleClick()">Download</a>`,
export class SimpleMenuComponent extends MenuComponent {
  // this module does not have animations, set lazy false
  lazy = false;

  constructor(public menuPackage: MenuPackage, public contextMenuService: ContextMenuService) {
    super(menuPackage, contextMenuService);
    // grab any required menu context passed via menuContext input

  handleClick() {
    // IMPORTANT! tell the menu to close, anything passed in here is given to (menuAction)

3. The last step is to add CSS somewhere in your global styles.

.cdk-overlay-container {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
.ngx-contextmenu.cdk-overlay-pane {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;

// not required but can help with mobile right click
.target {
  user-select: none;


contextMenuTrigger / contextSubmenuTriggercomponentthe menu or submenu to be shown
menuContextanypassed to the menu component via MenuPackage
holdToDisplaynumberdefault: 1000 ms pressing down on mobile to show menu


menuActionanywhatever is passed to ContextMenuService.closeAll
menuClosevoidtriggered whenever a menu or submenu is closed

Context Menu Service, ngx-rightclick Plugin/Github, angular grid context menu

See Demo And Download

Official Website(scttcper): Click Here

This superior jQuery/javascript plugin is developed by scttcper. For extra Advanced usage, please go to the official website.

Related Posts


Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…


Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…


Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…


Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…


How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…


Modern Mobile Touch Slider With Acceleration Transitions | Swiper

Swiper is the most modern free mobile touch slider with accelerated device transitions and amazing original behavior. It is intended for use in mobile websites, mobile web…

Leave a Reply

Your email address will not be published. Required fields are marked *