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.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ContextMenuContent
The ContextMenuContent component renders menu items at the pointer position.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ContextMenuHeader
The ContextMenuHeader component renders header content inside a context menu.
| Prop | Type | Default |
|---|---|---|
className | string | - |
separator | boolean | false |
ContextMenuItem
The ContextMenuItem component represents one context menu action.
| Prop | Type | Default |
|---|---|---|
className | string | - |
intent | "danger" | "warning" | - |
ContextMenuLabel
The ContextMenuLabel component renders the primary text for a context menu item.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ContextMenuDescription
The ContextMenuDescription component renders supporting text for a context menu item.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ContextMenuSection
The ContextMenuSection component groups related context menu items.
| Prop | Type | Default |
|---|---|---|
className | string | - |
label | string | - |
ContextMenuSeparator
The ContextMenuSeparator component separates context menu groups.
| Prop | Type | Default |
|---|---|---|
className | string | - |
ContextMenuShortcut
The ContextMenuShortcut component displays a keyboard shortcut for a context menu item.
| Prop | Type | Default |
|---|---|---|
className | string | - |
Intent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.