# @apitable/react-contexify

> Add contextmenu to your react component with ease

Latest version **5.0.7** (published 2022-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @apitable/react-contexify
pnpm add @apitable/react-contexify
yarn add @apitable/react-contexify
bun add @apitable/react-contexify
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.7 |
| Published | 2022-12-16 |
| First published | 2022-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 245.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | apitableinc, wangkailang992, vika-apitable |
| Keywords | react, context menu, react-component, menu, react-contextmenu, react-contexify, popup |

## Links

- npm: https://www.npmjs.com/package/@apitable/react-contexify
- Repository: https://github.com/apitable/react-contexify
- Homepage: https://github.com/apitable/react-contexify#readme
- Issues: https://github.com/apitable/react-contexify/issues
- npm.io page: https://npm.io/package/@apitable/react-contexify

## Dependencies (1)

- [clsx](https://npm.io/package/clsx.md) ^1.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 5.0.7 (latest) — 2022-12-16

## README

# @apitable/react-contexify

## Installation

Using yarn

```sh
$ yarn add @apitable/react-contexify
```

Using npm

```sh
$ npm install --save @apitable/react-contexify
```

## The gist

```js
import React from 'react';
import { Menu, Item, Separator, Submenu, MenuProvider } from '@apitable/react-contexify';
import '@apitable/react-contexify/dist/ReactContexify.css';

const MENU_ID = 'blahblah';

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

  function handleContextMenu(event){
      event.preventDefault();
      show({
        event,
        props: {
            key: 'value'
        }
      })
  }
  const handleItemClick = ({ event, props }) => console.log(event,props);

  return (
    <div>
    <p onContextMenu={handleContextMenu}>lorem ipsum blabladhasi blaghs blah</p>  
    <Menu id={MENU_ID}>
      <Item onClick={handleItemClick}>Item 1</Item>
      <Item onClick={handleItemClick}>Item 2</Item>
      <Separator />
      <Item disabled>Disabled</Item>
      <Separator />
      <Submenu label="Foobar">
        <Item onClick={handleItemClick}>Sub Item 1</Item>
        <Item onClick={handleItemClick}>Sub Item 2</Item>
      </Submenu>
    </Menu>
    </div>
  );
}
```

## License

React Contexify is licensed under MIT.

---
_Source: https://npm.io/package/@apitable/react-contexify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
