rec
react-electron-contextmenu
npm i react-electron-contextmenu
rec

react-electron-contextmenu

Makes it super easy to create context menus in your React powered Electron apps

by Johan Otterud

1.0.0 (see all)License:MITTypeScript:Not Found
npm i react-electron-contextmenu
Readme

React-electron-contextmenu

Makes it super easy to create context menus in your React powered Electron apps. TypeScript supported!

Installation

npm install react-electron-contextmenu --save

Usage

Import the component:

import ContextMenuArea from "react-electron-contextmenu";

Wrap the component you want to use as the right click area in the <ContextMenuArea> component and use in render method:

render() {
  const menuItems = [
    {
      label: "A menu item",
      submenu: [
        { label: "Submenu item", click: () => alert("I was clicked!") },
        {
          label: "Submenu item #2",
          click: () => alert("I was also clicked!")
        }
      ]
    },
    {
      label: "Another menu item",
      click: () => alert("I was clicked!")
    }
  ];
  return (
    <ContextMenuArea menuItems={menuItems}>
      <div>Right click me to show a context menu!</div>
    </ContextMenuArea>
  );
}

React-electron-context menu uses the menu template format from electron, see samples here:
https://electronjs.org/docs/api/menu#examples

Downloads/wk

18

GitHub Stars

12

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

2

OPEN PRs

1
VersionTagPublished
1.0.0
latest
5yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate