npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-menu-context

v0.0.2

Published

A lightweight and customizable React component for implementing context menus. It supports dynamic menu generation, flexible styling options, and both predefined and custom menu icons.

Readme

React context menu

version

A lightweight and customizable React component for implementing context menus. It supports dynamic menu generation, flexible styling options, and both predefined and custom menu icons.

This makes it ideal for applications requiring dynamic right-click menus with full control over behavior and appearance.

Project Screenshot

Key build-in features

  • ✅ Dynamic Menu items
  • ✅ Predefined icons
  • ✅ Custom icons
  • ✅ Multiple context menu implementation.

📦 Installation

npm install react-menu-context

🚀 Usage

import {ContextProvider, ContextMenu}  from "react-menu-context";


const menuItems=[
  {
    label:'Cut',  
    onClick:()=>{console.log('delete')},
    iconType:'scissor',
  },
  {
    label:'Copy task',
    onClick:()=>{console.log('delete')},
    iconType:'copy',
  },
  {
    label:'Edit content',
    onClick:()=>{console.log('delete')},
    icon:<CustomIcon/>,
  },
  {
    label:'Move to trash',
    onClick:()=>{console.log('delete')},
    iconType:'delete',
    disabled:true
  }
]

function App() {
  return (
    <ContextProvider id={123} className='custom-styling-name'>
      <button>Right clik context action</button>
      <ContextMenu 
        menuItems={menuItems}
        className='custom-class-name'
        id={123}
      />
    <ContextProvider/>
    
  );
}

ContextProvider

A React component that wraps and manages the display logic of the context menu.

props

| Name | Type | Default | Description | | --- | --- | ------ | ------- | | id | string, number | | The identfier that binds to ContextMenu. | | disabled | boolean | false | A boolean flag indicating whether the context menu is visible. | | className| string | | A custom className for enabling custom styling for the wrapper div of the context. |

ContextMenu

A React component that displays a list of contextual menu options in response to right click.

props

| Name | Type | Default | Description | | --- | --- | ------ | ------- | | id | string, number | | The identfier that binds ContextMenu with ContextProvider. | | className | string | | A custom className for enabling custom styling for the wrapper div of the context menu. | | menuItems | array | | Array of menu items object in the context menu. |

MenuItem

A data structure that defines a specific menu displayed in the context menu interface.

| Name | Type | Default | Description | | --- | --- | ------ | ------- | | label| string | | The label or text for the context menu. | | icon | component | | A custom component for icon. | | iconType| string | | built-in icon types identified by name. | | onClick | function | | function call when the specific menu item is clicked. | | disabled | boolean | false | Whether the menu item should be active or not. |

Icons

[!NOTE] There are two type of icons in the context menu

  1. built-in icons
  2. custom icons

built-in icons

build-in icons

The built-in icons can be added to the menu item by providing a name to the iconType

{
  ...,
  lable:'Move to trash'
  iconType:'delete'
},
{
  ...,
  label:'Save data'
  iconType:'save'
}

custom icons

Custom icons can be provided to the context menu as either React components returning SVG elements or as <img> tags referencing image files

  const MenuIcon=()=>{
    return(
      <svg>
          <path> ... </path>
      </svg>
    )
  }

  const menuItems=[
    {
      label:'Custom icon menu',
      icon:<MenuIcon />,
      onClick:{()=>console.log()}
    },
    {
      label:'Custom image menu',
      icon:<img src='./image/source' />,
      onClick:{()=>console.log()}
    }
  ]