Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icflorescu/mantine-contextmenu
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.
https://github.com/icflorescu/mantine-contextmenu
context-menu dark-mode dark-theme javascript mantine react typescript ui ui-kit
Last synced: 3 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/icflorescu/mantine-contextmenu
- Owner: icflorescu
- License: mit
- Created: 2023-04-11T15:56:19.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-04T08:21:07.000Z (5 months ago)
- Last Synced: 2024-10-29T14:58:32.938Z (3 months ago)
- Topics: context-menu, dark-mode, dark-theme, javascript, mantine, react, typescript, ui, ui-kit
- Language: TypeScript
- Homepage: https://icflorescu.github.io/mantine-contextmenu/
- Size: 5.36 MB
- Stars: 127
- Watchers: 4
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-react-components - mantine-contextmenu - [demo/docs](https://icflorescu.github.io/mantine-contextmenu/) - Context-menu hook/component for applications built with Mantine UI. (UI Components / Menu)
- fucking-awesome-react-components - mantine-contextmenu - 🌎 [demo/docs](icflorescu.github.io/mantine-contextmenu/) - Context-menu hook/component for applications built with Mantine UI. (UI Components / Menu)
- awesome-react-components - mantine-contextmenu - [demo/docs](https://icflorescu.github.io/mantine-contextmenu/) - Context-menu hook/component for applications built with Mantine UI. (UI Components / Menu)
- awesome-react-components - mantine-contextmenu - [demo/docs](https://icflorescu.github.io/mantine-contextmenu/) - Context-menu hook/component for applications built with Mantine UI. (UI Components / Menu)
README
# Mantine ContextMenu
![Publish NPM & deploy docs workflow](https://github.com/icflorescu/mantine-contextmenu/actions/workflows/publish-and-deploy.yml/badge.svg)
[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]
[![Stars][stars-image]][stars-url]
[![Last commit][last-commit-image]][repo-url]
[![Closed issues][closed-issues-image]][closed-issues-url]
[![Downloads][downloads-image]][npm-url]
[![Language][language-image]][repo-url]
[![Sponsor the author][sponsor-image]][sponsor-url]Craft your applications for productivity and meet your users’ expectations by enhancing your Mantine-based UIs with a desktop-grade, [lightweight](https://bundlephobia.com/package/mantine-contextmenu) yet fully-featured, **dark-theme aware** context-menu component, built by the creator of [Mantine DataTable](https://icflorescu.github.io/mantine-datatable/).
[![Mantine ContextMenu](https://user-images.githubusercontent.com/581999/294179957-e5b07f1f-701b-49a9-a518-4e42afb8b70a.png)](https://icflorescu.github.io/mantine-contextmenu/)
**⚠️ NOTE: Mantine ContextMenu V7 is compatible with Mantine V7.**
**💡 If you're looking for the old version that works with [Mantine V6](https://v6.mantine.dev), head over to [Mantine ContextMenu V6](https://icflorescu.github.io/mantine-contextmenu-v6).**## Features
- **[Lightweight](https://bundlephobia.com/package/mantine-contextmenu)** - no external dependencies, no bloat
- **Dark-theme aware** - automatically adapts to the current [Mantine color scheme](https://mantine.dev/theming/color-schemes/)
- **[Simple API](https://icflorescu.github.io/mantine-contextmenu/getting-started)** - just wrap your application in the `ContextMenuProvider` component and use the hook-generated function in your code
- **[Custom content support](https://icflorescu.github.io/mantine-contextmenu/examples/custom-content)** - use any Mantine component as context menu content
- **[Highly customizable styling](https://icflorescu.github.io/mantine-contextmenu/examples/styling)** - use the `className`/`classNames` and `style`/`styles` props to customize the context menu appearance
- **[Written in Typescript and well-documented](https://icflorescu.github.io/mantine-contextmenu/type-definitions)** - with detailed JSDoc annotations for each exported function and component## Full documentation and examples
Visit [icflorescu.github.io/mantine-contextmenu](https://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](https://mantine.dev/pages/getting-started/), 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:
```ts
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](https://mantine.dev/styles/mantine-styles/):
```css
/* layout.css */
/* 👇 Apply Mantine core styles first, ContextMenu styles second */
@layer mantine, mantine-contextmenu;
```Wrap your application in a `ContextMenuProvider` **inside** the `MantineProvider`:
```tsx
import { MantineProvider } from '@mantine/core';
import { ContextMenuProvider } from 'mantine-contextmenu';function App() {
return (
{/* your app code here... */}
);
}
```Use the `showContextMenu` function generated by the `useContextMenu` in your code:
```tsx
'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 contextimport { 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 (
,
title: 'Copy to clipboard',
onClick: () => copyImageToClipboard(src),
},
{
key: 'download',
icon: ,
title: 'Download to your computer',
onClick: () => downloadImage(src),
},
])}
/>
);
}
```Make sure to browse the list of [usage examples](https://icflorescu.github.io/mantine-contextmenu/examples/basic-usage) to learn how to unleash the full power of Mantine ContextMenu.
## Other useful resources
💡 [Mantine DataTable](https://icflorescu.github.io/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](https://user-images.githubusercontent.com/581999/294180790-93289cec-4d73-47b5-988f-8c93dd3443fe.png)](https://icflorescu.github.io/mantine-datatable/)
## Contributing
See the [contributing guide in the documentation website](https://icflorescu.github.io/mantine-contextmenu/contribute-and-support) or the repo [CONTRIBUTING.md](https://github.com/icflorescu/mantine-contextmenu/blob/master/CONTRIBUTING.md) file for details.
💡 Most importantly, **please make sure to target your PRs to the `next` branch!**
Here's the list of people who have already contributed to Mantine ContextMenu:
[![Contributors list](https://contrib.rocks/image?repo=icflorescu/mantine-contextmenu)](https://github.com/icflorescu/mantine-contextmenu/graphs/contributors)
Want to [become a code contributor](https://icflorescu.github.io/mantine-contextmenu/contribute-and-support)?
## Support the project
If you find this package useful, please consider ❤️ [sponsoring my work](https://github.com/sponsors/icflorescu).
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](https://icflorescu.github.io/mantine-datatable/) in a commercial project, you can also [hire my services](https://github.com/icflorescu).## 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:
- 🙏 star the repository;
- 💕 [tweet about it](https://twitter.com/share?text=Check%20out%20the%20missing%20context-menu%20for%20Mantine%20UI%20applications!&url=https%3A%2F%2Fgithub.com%2Ficflorescu%2Fmantine-contextmenu&hashtags=react%2Cmantine%2Cui%2Ccontextmenu%2Cfrontend%2Copensource&via=icflorescu);
- 👍 [endorse me on LinkedIn](https://www.linkedin.com/in/icflorescu).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](https://github.com/icflorescu).
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](https://github.com/icflorescu/mantine-contextmenu/blob/master/LICENSE).
[npm-url]: https://npmjs.org/package/mantine-contextmenu
[repo-url]: https://github.com/icflorescu/mantine-contextmenu
[stars-url]: https://github.com/icflorescu/mantine-contextmenu/stargazers
[closed-issues-url]: https://github.com/icflorescu/mantine-contextmenu/issues?q=is%3Aissue+is%3Aclosed
[license-url]: LICENSE
[npm-image]: https://img.shields.io/npm/v/mantine-contextmenu.svg?style=flat-square
[license-image]: http://img.shields.io/npm/l/mantine-contextmenu.svg?style=flat-square
[downloads-image]: http://img.shields.io/npm/dm/mantine-contextmenu.svg?style=flat-square
[stars-image]: https://img.shields.io/github/stars/icflorescu/mantine-contextmenu?style=flat-square
[last-commit-image]: https://img.shields.io/github/last-commit/icflorescu/mantine-contextmenu?style=flat-square
[closed-issues-image]: https://img.shields.io/github/issues-closed-raw/icflorescu/mantine-contextmenu?style=flat-square
[language-image]: https://img.shields.io/github/languages/top/icflorescu/mantine-contextmenu?style=flat-square
[sponsor-image]: https://img.shields.io/badge/sponsor-violet?style=flat-square
[sponsor-url]: https://github.com/sponsors/icflorescu