All Projects → reachtokish → rctx-contextmenu

reachtokish / rctx-contextmenu

Licence: other
✨ Context menu for React

Programming Languages

javascript
184084 projects - #8 most used programming language
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to rctx-contextmenu

ng2-right-click-menu
Right click context menu for Angular 2+
Stars: ✭ 51 (+121.74%)
Mutual labels:  contextmenu, context-menu, right-click
ctxmenu
Tiny and customizable context menu generator
Stars: ✭ 20 (-13.04%)
Mutual labels:  contextmenu, context-menu, right-click
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-39.13%)
Mutual labels:  context-menu, right-click
elm-contextmenu
Flexible context menu for Elm
Stars: ✭ 16 (-30.43%)
Mutual labels:  contextmenu, context-menu
Open in Windows Terminal
No description or website provided.
Stars: ✭ 24 (+4.35%)
Mutual labels:  contextmenu, context-menu
Pie-Context-Menu
A Pie Context Menu for Web pages
Stars: ✭ 20 (-13.04%)
Mutual labels:  context-menu, right-click
JonContextMenu
A beautiful and minimalist arc menu like the Pinterest one, written in Swift
Stars: ✭ 60 (+160.87%)
Mutual labels:  contextmenu, context-menu
ContextMenuSwift
A better version of iOS 13 Context Menu
Stars: ✭ 162 (+604.35%)
Mutual labels:  contextmenu, context-menu
ShellAnything
ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
Stars: ✭ 103 (+347.83%)
Mutual labels:  contextmenu, context-menu
Context Menu.ios
You can easily add awesome animated context menu to your app.
Stars: ✭ 1,854 (+7960.87%)
Mutual labels:  contextmenu, context-menu
Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (+252.17%)
Mutual labels:  contextmenu, context-menu
vue3-context-menu
A very simple context menu component for Vue3 一个简洁美观简单的Vue3右键菜单组件
Stars: ✭ 74 (+221.74%)
Mutual labels:  contextmenu, context-menu
VirusTotalScanner
Scan suspicious applications with over 60 different anti-viruses with a mere two clicks and five seconds!
Stars: ✭ 18 (-21.74%)
Mutual labels:  contextmenu, context-menu
xMenuTools
Extended context menu tools for Windows
Stars: ✭ 56 (+143.48%)
Mutual labels:  context-menu, right-click
editable-treemenu
a treemenu component which can edit(add/delete/rename) by contextMenu based on vue.js 2.0
Stars: ✭ 24 (+4.35%)
Mutual labels:  contextmenu
vaadin-context-menu
The responsive Web Component for showing context dependent items for any element on the page. Part of the Vaadin components.
Stars: ✭ 26 (+13.04%)
Mutual labels:  context-menu
Modern-UI-Components-for-VBA
A helper dll for VBA users to design modern UI components. No install required!
Stars: ✭ 139 (+504.35%)
Mutual labels:  contextmenu
ShellCommand
Customize your context menu. 告别注册表,自定义右键菜单。
Stars: ✭ 64 (+178.26%)
Mutual labels:  contextmenu
bookmarklets-context-menu
WebExtension allow to execute bookmarklets as privileged scripts
Stars: ✭ 67 (+191.3%)
Mutual labels:  contextmenu
RCWM
Right Click Windows Magic is an open-source set of right-click (context) menu tools for admins, power users and other magic beings. Batch&Powershell.
Stars: ✭ 39 (+69.57%)
Mutual labels:  right-click

NPM Badge

Note: rctx-contextmenu Supports React 16.8 and above versions because this plugin solely uses React Hooks.

rctx-contextmenu

Context menu plugin for React. Live Demo | Example Code

RCTX Contextmenu

The problem 😯

There are lot of times when you want to customize the right click menu or Context Menu. May be you want to add more customized options or even sub options with same look and feel how a native context menu gives.

The solution 😄

rctx-contextmenu gives that flexibility to customize Context Menu. You can add options, sub-options with exactly the look and feel how you get when you use the native Context Menu.

Key features

  • Append to anywhere you want
  • Customize styling like however you want
  • In-built animation
  • Extensive list of APIs
  • Dynamically add/remove menus

Browser Support

  • IE 11 and Edge >= 12
  • FireFox >= 38
  • Chrome >= 47

Table of contents

Installation

npm install --save rctx-contextmenu

Sample Usage

import React from 'react';
import { ContextMenuTrigger, ContextMenu, ContextMenuItem } from 'rctx-contextmenu';

function App() {
  return (
    <div className="app">
      <ContextMenuTrigger
        id="my-context-menu-1"
      >
        <div className="box">
          Right Click On Me
        </div>
      </ContextMenuTrigger>

      <ContextMenu id="my-context-menu-1">
        <ContextMenuItem>Menu Item 1</ContextMenuItem>
        <ContextMenuItem>Menu Item 2</ContextMenuItem>
        <ContextMenuItem>Menu Item 3</ContextMenuItem>
        <ContextMenuItem>Menu Item 4</ContextMenuItem>
      </ContextMenu>
    </div>
  );
}

export default App;

Full example usage

<ContextMenu
  id="my-contextmenu"
  appendTo="body"
  animation="zoom"
  hideOnLeave={false}
  preventHideOnScroll={true}
  preventHideOnResize={true}
  attributes={{
    'aria-label': 'Some text',
    'aria-labelledby': 'Some text'
  }}
  className="my-context-menu"
  onMouseLeave={() => console.log('Mouse left')}
  onShow={() => console.log('I am visible!')}
  onHide={() => console.log('I am hidden!')}
/>
<ContextMenuItem
  disabled={true}
  preventClose={false}
  attributes={{
    'aria-label': 'Some text',
    'aria-labelledby': 'Some text'
  }}
  className="my-context-menu-item"
  onClick={() => console.log("I'm clicked!")}
/>
<ContextMenuTrigger
  id="my-contextmenu"
  disable={false}
  disableWhileShiftPressed={true}
  attributes={{
    'aria-label': 'Some text',
    'aria-labelledby': 'Some text'
  }}
  className="my-context-menu-trigger"
/>
<Submenu
  title="My submenu"
  attributes={{
    'aria-label': 'Some text',
    'aria-labelledby': 'Some text'
  }}
  className="my-context-menu-submenu"
/>

Live Demo

Live demo is available here.

Example Code

Example code is available here.

APIs

<ContextMenu />

Name Type Options Description
id String Should be a string. `ContextMenu` and `ContextMenuTrigger` id should match.
appendTo String Should be a string which contains element selector like body / #id / .class . Default: Enclosed element Append context menu inside required element.
animation String Enums: fade | zoom | pop | toTopLeft | rightToLeft Make the contextmenu visible in animated way.
hideOnLeave Boolean true / false. Default: false Hide contextmenu on blur or mouseOut.
attributes Object - Add additional attributes to the element.
className String - Additional classes.
preventHideOnResize Boolean true / false. Default: false Prevent hiding contextmenu from hiding on window resize.
preventHideOnScroll Boolean true / false. Default: false Prevent hiding contextmenu from hiding on scroll.
onShow Function () => {} Trigger this event when Context Menu is visible.
onHide Function () => {} Trigger this event when Context Menu is hidden.
onMouseLeave Function () => {} Invoke onMouseLeave on blur or mouseOut.

<ContextMenuItem />

Name Type Options Description
disabled Boolean true / False . Default False Disable menu item.
preventClose Boolean true / False . Default False Context menu is closed as soon as an item is clicked.
disableWhileShiftPressed Boolean true / false. Default: false Open browser default contextmenu if shift pressed while right click on trigger element.
attributes Object - Add additional attributes to the element.
className String - Additional classes.
onClick Function () => {} Fire onClick event.

<ContextMenuTrigger />

Name Type Options Description
id String Should be a string. `ContextMenu` and `ContextMenuTrigger` id should match.
attributes Object - Add additional attributes to the element.
disable true / false. Default: false false Disable contextmenu and open browser default contextmenu.
className String - Additional classes.

<Submenu />

Name Type Options Description
title String Should be a string. Title for the Submenu.
attributes Object - Add additional attributes to the element.
className String - Additional classes.

Styling

Styling is totally up to you. You can use CSS or even SCSS to customize the styling part. Below are the classes you can consider for styling

  • menu-trigger (Right click area wrapper)
  • contextmenu (The Context Menu)
  • contextmenu__item (Each Context Menu item)
  • contextmenu__item--disabled (Context Menu item)
  • submenu (Context Submenu)
  • submenu__item (Context Submenu item)

Contributions 🙏

Any kind of contribution would be much appreciated. It could be small change in the doc or even any kind of advice. You can create issues if you feel any feature which is missing which solves bigger problems.

Develop locally

First clone the repo

git clone https://github.com/reachtokish/rctx-contextmenu.git

Navigate inside rctx-contextmenu folder

cd rctx-contextmenu

Install dependencies

npm install

Then start server to run it locally

npm start

Now app should run on localhost:1234

Design inspiration Khalid Hasan Zibon / Dribble

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].