MCPcopy Create free account
hub / github.com/fkhadra/react-contexify

github.com/fkhadra/react-contexify @v6.0.0-doc-1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v6.0.0-doc-1 ↗ · + Follow
88 symbols 159 edges 33 files ⚖ MIT 1 documented · 1% 9 cross-repo links updated 21mo agov6.0.0 · 2022-11-13★ 1,22434 open issues

Browse by type

Functions 65 Types & classes 23
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

screenshot 2018-10-31 at 13 32 57

React-contexify CI npm npm license

contexify

Features

  • Easy to set up for real, you can make it work in less than 10sec!
  • Super easy to customize thanks to css variables 💅
  • Custom position
  • Sub menu support
  • Does not go offscreen
  • Dark mode 🌒
  • Keyboard navigation + keyboard shortcut!
  • Built-in animations
  • Easy to test!
  • Written in Typescript 💪
  • Tiny! (3k gzipped)

Check the documentation for more!

Documentation

Go here.

Installation

Using yarn

$ yarn add react-contexify

Using npm

$ npm install --save react-contexify

The gist

import { Menu, Item, Separator, Submenu, useContextMenu } from 'react-contexify';
import 'react-contexify/ReactContexify.css';

const MENU_ID = 'blahblah';

function App() {
  const { show } = useContextMenu({
    id: MENU_ID,
  });

  function handleContextMenu(event){
      show({
        event,
        props: {
            key: 'value'
        }
      })
  }

  // I'm using a single event handler for all items
  // but you don't have too :)
  const handleItemClick = ({ id, event, props }) => {
    switch (id) {
      case "copy":
        console.log(event, props)
        break;
      case "cut";
        console.log(event, props);
        break;
      //etc...
    }
  }

  return (





lorem ipsum blabladhasi blaghs blah


    <Menu id={MENU_ID}>
      <Item id="copy" onClick={handleItemClick}>Copy</Item>
      <Item id="cut" onClick={handleItemClick}>Cut</Item>
      <Separator />
      <Item disabled>Disabled</Item>
      <Separator />
      <Submenu label="Foobar">
        <Item id="reload" onClick={handleItemClick}>Reload</Item>
        <Item id="something" onClick={handleItemClick}>Do something else</Item>
      </Submenu>
    </Menu>



  );
}

Contribute

Any idea and suggestions are welcome. Please have a look at the contributing guide.

License

React Contexify is licensed under MIT.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 62
Interface 20
Enum 3
Method 3

Languages

TypeScript100%

Modules by API surface

src/components/keyboardController.ts13 symbols
src/components/Menu.tsx11 symbols
example/components/App.tsx10 symbols
src/core/eventManager.ts8 symbols
src/components/Item.tsx6 symbols
src/components/utils.ts5 symbols
src/hooks/useContextMenu.ts4 symbols
src/core/contextMenu.ts4 symbols
src/components/Submenu.tsx4 symbols
src/types/index.ts3 symbols
src/constants.ts3 symbols
src/components/ItemTrackerProvider.tsx3 symbols

For agents

$ claude mcp add react-contexify \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page