Skip to content

Context Menu

Opens a custom action menu right at the cursor position when users right-click or long-press an element on the screen.

11.7 KB
•
Updated on August 21, 2026
Right click here

Installation

Bash

Usage

Code
Code

Anatomy

Code

Accessibility

  • Follows the WAI-ARIA Menu Pattern.
  • Activated on right-click or long-press, with full keyboard traversal.

Keyboard Interactions

API Reference

ContextMenu

Root component. Alias for ContextMenu.Root from Base UI.

ContextMenuTrigger

An area that opens the menu on right click or long press. Renders a <div> element.

ContextMenuPopup

Popup container that displays the menu content at the pointer.

ContextMenuGroup

Groups related menu items. Alias for ContextMenu.Group from Base UI.

ContextMenuItem

Individual menu item.

Using inset: When mixing items with and without icons, use inset on icon-less items to maintain alignment:

Code

ContextMenuLinkItem

Link menu item for navigation. LinkItem renders a native <a> when you pass href. Styled like ContextMenuItem.

If you were using ContextMenuItem render={<Link href="..." />}, migrate to ContextMenuLinkItem but keep render — do not replace it with href alone when using a router Link.

Code

Use href only for plain anchor links:

Code

ContextMenuCheckboxItem

Checkbox menu item.

ContextMenuRadioGroup

Groups radio menu items. Alias for ContextMenu.RadioGroup from Base UI.

ContextMenuRadioItem

Radio menu item. Styled wrapper for ContextMenu.RadioItem from Base UI.

ContextMenuGroupLabel

Label for a menu group.

ContextMenuSeparator

Visual separator between menu items.

ContextMenuShortcut

Displays keyboard shortcut text. Custom component (not a Base UI wrapper).

ContextMenuSub

Submenu container. Alias for ContextMenu.SubmenuRoot from Base UI.

ContextMenuSubTrigger

Trigger for opening a submenu.

ContextMenuSubPopup

Popup for submenu content.

Examples

Nested context menu
Right click here
Context menu with checkbox items
Right click here
Context menu with group labels
Right click here
Context menu with icons
Right click here
Context menu with radio group
Right click here
Context menu with switch checkbox items
Right click here