10.0k

Context Menu

A menu that appears at the pointer on right click or long press.

API Reference

Installation

Usage

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:

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.

Use href only for plain anchor links:

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 Menu

With Checkbox

With Group Label

With Icons

With Radio Group

With Switch

ContextMenuCheckboxItem supports a variant="switch" prop that displays a decorative switch indicator instead of a checkmark. This is a purely visual variant — the component remains a checkbox item with the same functionality.

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).