ContextMenu

A menu that opens on right-click or long press.

Base UI Context MenuSource

Basic context menu

Right-click the area, or touch and hold it on a touch screen. The menu opens at the pointer.

Right-click here

Usage

These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.

  • A context menu is hidden until the user right-clicks. Make every command in it also available in a visible place, such as a Menu or a button.
  • Give the trigger area a visible edge, so users can find it.

API

Props that the library adds. Every part also takes all the Base UI props.

ContextMenu.Popup

PropTypeDefaultDescription
containerHTMLElement | ShadowRoot | RefObject | null–The element that the menu renders into. The default is the document body.