New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-context-menu

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-context-menu

A lightweight right-click context menu implemented in React.

latest
Source
npmnpm
Version
3.0.2
Version published
Maintainers
1
Created
Source

react-context-menu

A lightweight right-click context menu implemented in React.

example right-click menu

To use:

Install the component in your project:

npm install react-context-menu --save

or, if using yarn:

yarn add --dev react-context-menu

Import the component into your project:

import ContextMenu from 'react-context-menu';

Pass a contextId, and an array of menu items with labels, onClick functions, and optional icon paths -- like so:

<ContextMenu
  contextId={'clickable-area'}
  items={[
    {
      label: 'Configure',
      onClick: this.configHandler,
      icon: 'path/to/icon.svg'
    },
    {
      label: 'Delete',
      onClick: this.deleteHandler
    }
  ]} />

The contextId is the area in which you'd like right-click functionality. Add a unique id to your right-clickable element, and react-context-menu will be available anywhere within that element.

Pass closeOnClick (boolean defaulted to false) to ContextMenu to close the menu upon item click.

Pass closeOnClickOut (boolean defaulted to false) to ContextMenu to close the menu upon clicking outside of the menu (versus the default, which will close the menu when the mouse moves outside of the menu boundary).

Keywords

react

FAQs

Package last updated on 08 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts