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.

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.

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 tailwind-merge

Examples

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']} />

Component API

ContextMenu

The ContextMenu component provides context menu state for its trigger and content.

ContextMenuTrigger

The ContextMenuTrigger component defines the element that opens a context menu.

PropTypeDefault
classNamestring-

ContextMenuContent

The ContextMenuContent component renders menu items at the pointer position.

PropTypeDefault
classNamestring-

ContextMenuHeader

The ContextMenuHeader component renders header content inside a context menu.

PropTypeDefault
classNamestring-
separatorbooleanfalse

ContextMenuItem

The ContextMenuItem component represents one context menu action.

PropTypeDefault
classNamestring-
intent"danger" | "warning"-

ContextMenuLabel

The ContextMenuLabel component renders the primary text for a context menu item.

PropTypeDefault
classNamestring-

ContextMenuDescription

The ContextMenuDescription component renders supporting text for a context menu item.

PropTypeDefault
classNamestring-

ContextMenuSection

The ContextMenuSection component groups related context menu items.

PropTypeDefault
classNamestring-
labelstring-

ContextMenuSeparator

The ContextMenuSeparator component separates context menu groups.

PropTypeDefault
classNamestring-

ContextMenuShortcut

The ContextMenuShortcut component displays a keyboard shortcut for a context menu item.

PropTypeDefault
classNamestring-
Unlock the full power of
Intent UI Design

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

Learn more