@codemotion/react-contextmenu
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

NPM version Build Status Dependency Status Dev Dependency Status Code Climate

React Contextmenu

Context menu in React. Live examples can be found here

Links

Table of contents

Installation

yarn add react-contextmenu

Browser Support

  • IE 11 and Edge >= 12
  • FireFox >= 38
  • Chrome >= 47
  • Opera >= 34
  • Safari >= 8

Usage

Simple example

import React from "react";
import ReactDOM from "react-dom";
import { ContextMenu, MenuItem, ContextMenuTrigger } from "react-contextmenu";

function handleClick(e, data) {
  console.log(data);
}

function MyApp() {
  return (
    <div>

      <ContextMenuTrigger id="some_unique_identifier">
        <div className="well">Right click to see the menu</div>
      </ContextMenuTrigger>

      <ContextMenu id="some_unique_identifier">
        <MenuItem data={"some_data"} onClick={this.handleClick}>
          ContextMenu Item 1
        </MenuItem>
        <MenuItem data={"some_data"} onClick={this.handleClick}>
          ContextMenu Item 2
        </MenuItem>
        <MenuItem divider />
        <MenuItem data={"some_data"} onClick={this.handleClick}>
   	      ContextMenu Item 3
        </MenuItem>
      </ContextMenu>

    </div>
  );
}

ReactDOM.render(<MyApp myProp={12}/>, document.getElementById("main"));

see usage docs / examples for more details.

Contributors

All Contributors

Changelog

For Changelog, see releases

License

MIT. Copyright(c) Vivek Kumar Bansal

/@codemotion/react-contextmenu/

    Package Sidebar

    Install

    npm i @codemotion/react-contextmenu

    Weekly Downloads

    6

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • uffo
    • nyanev
    • nikolay_543