7.8.1 • Published 6 days ago

mantine-contextmenu v7.8.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

Mantine ContextMenu

Publish NPM & deploy docs workflow
NPM version License Stars Last commit Closed issues Downloads Language Sponsor the author

Craft your applications for productivity and meet your users’ expectations by enhancing your Mantine-based UIs with a desktop-grade, lightweight yet fully-featured, dark-theme aware context-menu component, built by the creator of Mantine DataTable.

Mantine ContextMenu

⚠️ NOTE: Mantine ContextMenu V7 is compatible with Mantine V7.
💡 If you're looking for the old version that works with Mantine V6, head over to Mantine ContextMenu V6.

Features

Full documentation and examples

Visit icflorescu.github.io/mantine-contextmenu to view the full documentation and learn how to use it by browsing the list of usage examples.

Quickstart

Create a new Mantine application, make sure to have the clsx peer dependency installed, then install the package with npm i mantine-contextmenu or yarn add mantine-contextmenu.

Import the necessary CSS files:

import '@mantine/core/styles.layer.css';
import 'mantine-contextmenu/styles.layer.css';
import './layout.css';

Make sure to apply the styles in the correct order:

/* layout.css */
/* 👇 Apply Mantine core styles first, ContextMenu styles second */
@layer mantine, mantine-contextmenu;

Wrap your application in a ContextMenuProvider inside the MantineProvider:

import { MantineProvider } from '@mantine/core';
import { ContextMenuProvider } from 'mantine-contextmenu';

function App() {
  return (
    <MantineProvider>
      <ContextMenuProvider>{/* your app code here... */}</ContextMenuProvider>
    </MantineProvider>
  );
}

Use the showContextMenu function generated by the useContextMenu in your code:

'use client';
// 👆 Since 'useContextMenu' is a hook, don't forget to add the 'use client' directive
//    at the top of your file if you're using it in a RSC context

import { IconCopy, IconDownload } from '@tabler/icons-react';
import { useContextMenu } from 'mantine-contextmenu';
import Picture from '~/components/Picture';
import { copyImageToClipboard, downloadImage, unsplashImages } from '~/lib/image';

export default function GettingStartedExample() {
  const { showContextMenu } = useContextMenu();

  const image = unsplashImages[0];
  const { src } = image.file;

  return (
    <Picture
      image={image}
      onContextMenu={showContextMenu([
        {
          key: 'copy',
          icon: <IconCopy size={16} />,
          title: 'Copy to clipboard',
          onClick: () => copyImageToClipboard(src),
        },
        {
          key: 'download',
          icon: <IconDownload size={16} />,
          title: 'Download to your computer',
          onClick: () => downloadImage(src),
        },
      ])}
    />
  );
}

Make sure to browse the list of usage examples to learn how to unleash the full power of Mantine ContextMenu.

Other useful resources

💡 Mantine DataTable - The lightweight, dependency-free, dark-theme aware table component for your Mantine UI data-rich applications, featuring asynchronous data loading support, pagination, intuitive Gmail-style additive batch rows selection, column sorting, custom cell data rendering, row expansion, nesting, context menus, and much more. Built by the creator of Mantine ContextMenu.

Mantine DataTable

Contributing

See the contributing guide in the documentation website or the repo CONTRIBUTING.md file for details.

Here's the list of people who have already contributed to Mantine ContextMenu:

Contributors list

Want to become a code contributor?

Support the project

If you find this package useful, please consider ❤️ sponsoring my work.
Your sponsorship will help me dedicate more time to maintaining the project and will encourage me to add new features and fix existing bugs.
If you're a company using Mantine, Mantine ContextMenu or Mantine DataTable in a commercial project, you can also hire my services.

Other means of support

If you can't afford to sponsor the project or hire my services, there are other ways you can support my work:

The more stars this repository gets, the more visibility it gains among the Mantine users community. The more users it gets, the more chances that some of those users will become active code contributors willing to put their effort into bringing new features to life and/or fixing bugs.

As the repository gain awareness, my chances of getting hired to work on Mantine-based projects will increase, which in turn will help maintain my vested interest in keeping the project alive.

Hiring the author

If you want to hire my services, don't hesitate to drop me a line at the email address listed in my GitHub profile.
I'm currently getting a constant flow of approaches, some of them relevant, others not so relevant.
Mentioning “Mantine ContextMenu” in your text would help me prioritize your message.

License

The MIT License.

7.8.1

6 days ago

7.8.0

20 days ago

7.7.0

28 days ago

7.6.2

2 months ago

7.6.1

2 months ago

7.6.0

2 months ago

7.5.0

3 months ago

7.4.1

3 months ago

7.4.0

4 months ago

7.3.3

4 months ago

7.3.1

5 months ago

7.3.0

5 months ago

7.3.2

5 months ago

7.0.0-alpha.1

7 months ago

6.1.0

6 months ago

7.0.0-alpha.6

6 months ago

7.1.3

6 months ago

7.0.0-alpha.3

7 months ago

7.1.2

6 months ago

7.0.0-alpha.2

7 months ago

7.1.1

6 months ago

7.0.0-alpha.5

7 months ago

7.1.0

6 months ago

7.0.0-alpha.4

7 months ago

6.0.6

6 months ago

6.0.1

7 months ago

6.0.0

7 months ago

6.0.3

7 months ago

6.0.2

7 months ago

6.0.5

7 months ago

6.0.4

7 months ago

7.1.11

6 months ago

7.1.12

6 months ago

7.1.10

6 months ago

7.1.7

6 months ago

7.1.6

6 months ago

7.1.5

6 months ago

7.1.4

6 months ago

7.1.9

6 months ago

7.1.8

6 months ago

1.3.15

8 months ago

1.2.18

11 months ago

1.3.7

10 months ago

1.2.8

12 months ago

1.3.6

10 months ago

1.2.7

12 months ago

1.3.5

10 months ago

1.3.4

10 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.3.10

9 months ago

1.3.13

9 months ago

1.3.14

9 months ago

1.3.11

9 months ago

1.3.12

9 months ago

1.3.9

9 months ago

1.3.8

10 months ago

1.2.9

12 months ago

1.2.12

11 months ago

1.2.13

11 months ago

1.2.10

11 months ago

1.2.11

11 months ago

1.2.16

11 months ago

1.2.17

11 months ago

1.2.14

11 months ago

1.2.15

11 months ago

1.2.6

12 months ago

1.2.5

12 months ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.0

1 year ago