react-contextmenu-dk
v2.13.1
Published
Context Menu implemented in React, with checks for touch devices
Downloads
12
Maintainers
Readme
!!! Looking for maintainers !!!
React Contextmenu
ContextMenu in React with accessibility support. Live Examples can be found here
Table of contents
Installation
Using npm
npm install --save react-contextmenu-dk
Using yarn
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.foo);
}
function MyApp() {
return (
<div>
<ContextMenuTrigger id="some_unique_identifier"> {/* NOTICE: id must be unique for EVERY instance */}
<div className="well">Right click to see the menu</div>
</ContextMenuTrigger>
<ContextMenu id="some_unique_identifier">
<MenuItem data={{foo: 'bar'}} onClick={this.handleClick}>
ContextMenu Item 1
</MenuItem>
<MenuItem data={{foo: 'bar'}} onClick={this.handleClick}>
ContextMenu Item 2
</MenuItem>
<MenuItem divider />
<MenuItem data={{foo: 'bar'}} onClick={this.handleClick}>
ContextMenu Item 3
</MenuItem>
</ContextMenu>
</div>
);
}
ReactDOM.render(<MyApp myProp={12}/>, document.getElementById("main"));
See usage docs / examples for more details.
See react-contextmenu.css for theming example.
API
FAQs
Who's using react-contextmenu?
Contributors
Changelog
For Changelog, see releases
License
MIT. Copyright(c) Vivek Kumar Bansal