ContextMenu

A right-click menu family for compact action, selection, and nested action surfaces.

Preview#

Preview defaults the menu open so the row styling and density are visible immediately; dismiss it and right-click the trigger to reopen it.

Right click thread
import {
  ContextMenu,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuLabel,
  ContextMenuSeparator,
  ContextMenuShortcut,
  ContextMenuTrigger,
} from "raft-ui";

<ContextMenu>
  <ContextMenuTrigger />
  <ContextMenuContent>
    <ContextMenuLabel />
    <ContextMenuItem>
      <ContextMenuShortcut />
    </ContextMenuItem>
    <ContextMenuSeparator />
  </ContextMenuContent>
</ContextMenu>

Radio group#

Right click notification

Checkboxes#

Right click list

API#WIP

...props
Base UI ContextMenu.Root.Props
Owns right-click open state, focus roving, keyboard navigation, and dismissal.
...props
Base UI ContextMenu.Trigger.Props
Right-click or long-press target. Renders a div and keeps text selection off.
container
HTMLElement | RefObject | null
Custom portal container for framed previews or contained overlays.
...props
Base UI ContextMenu.Portal.Props
Portals the menu to the body or a custom container.
...props
Base UI Popup + Positioner props
Portaled floating menu shell. Keeps the menu near the context point while shifting it inside the collision boundary with 8px of padding.
...props
ComponentPropsWithRef<"div">
Static panel shell for docs previews and non-portaled comparison panes.
...props
Base UI ContextMenu.Item.Props
Action row. Compose leading icons, label text, and trailing shortcuts as children.
...props
StyledProps<ComponentPropsWithRef<"span">>
Small muted label above grouped items or inside an item.
...props
div props
Section label for grouped rows.
...props
Kbd props
Right-aligned keyboard hint composed inside a menu row.
...props
Base UI ContextMenu.Separator.Props
Group separator mapped from the source ContextMenuDivider primitive.
...props
Base UI ContextMenu.RadioGroup.Props
Single-selection group inside the menu.
...props
Base UI ContextMenu.RadioItem.Props
Selectable row with a trailing check indicator.
...props
Base UI ContextMenu.RadioItemIndicator.Props
Radio dot shown inside a selected ContextMenuRadioItem.
...props
Base UI ContextMenu.CheckboxItem.Props
Toggleable row with a trailing check indicator.
...props
Base UI ContextMenu.CheckboxItemIndicator.Props
Check indicator shown inside a checked ContextMenuCheckboxItem.
...props
Base UI ContextMenu.SubmenuRoot.Props
Nested context-menu branch for secondary action groups.
...props
Base UI ContextMenu.SubmenuTrigger.Props
Row that opens a nested menu. Compose the chevron as the trailing icon.