fkhadra/react-contexify
fkhadra/react-contexify has 1,226 GitHub stars and 132 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-09 07:38 UTC. Last push 2024-11-25.
👌 Add a context menu to your react app with ease
What you can do
- 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
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Original

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 (
<div>
<p onContextMenu={handleContextMenu}>lorem ipsum blabladhasi blaghs blah</p>
<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>
</div>
);
}
Contribute
Any idea and suggestions are welcome. Please have a look at the contributing guide.
License
React Contexify is licensed under MIT.
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,823 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,441 starsreact/react
The library for web and native user interfaces.
252,445 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,624 stars