Controls

Context Menu

Opens a menu at your cursor on right click, giving fast access to relevant actions based on the current context, boosting productivity and usability.

Basic

This component excels in desktop applications but has significant limitations. Its lack of accessibility and mobile compatibility are notable drawbacks. React Aria hasn't released an official version of this component yet, possibly due to these issues.

Unless it's absolutely necessary for your project, I'd advise against using it. For most scenarios requiring accessible, rich interfaces, consider alternatives like Menus or Popovers instead. These components typically offer better cross-platform support and accessibility features.

The initial release will be an alpha version due to ongoing issues with cursor positioning accuracy. If you're able to contribute, I'd appreciate your help in submitting a pull request to address this component's limitations.

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/context-menu

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

This component comes packed with several components to enhance functionality and provide a seamless experience.

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components @heroicons/react

Description

You can add details to menu items by using the ContextMenuDescription component.

Danger

Designate a menu item as dangerous.

With icon

Enhance context menu item by adding icons.

Separator

Separate context menu items with a separator.

Context sub menu

Sorry, this component doesn't exist yet. It's on our roadmap.

Disabled

Disable specific menu items.

Also, you can disable items directly in MenuContent by using the disabledKeys prop.

<ContextMenuContent disabledKeys={['gsu']} />
Unlock the full power of
Design Intent UI

Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.

Learn more