---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Context menu

A menu of a target's secondary actions, opened at the pointer, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `ContextMenu`.

## When to use

- A menu of a target's secondary actions, opened at the pointer.
- Also called: right-click menu.

## When not to use

- For a button's menu use DropdownMenu.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Context menu on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-context-menu.json --yes
```

```text
Add the Goop Context menu to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import {
  ContextMenuPortal, ContextMenuGroup, ContextMenuLabel, ContextMenuShortcut, ContextMenuCheckboxItem, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub,
  ContextMenuSubTrigger, ContextMenuSubContent,
} from '@/components/ui/goop/context-menu';

import {
  ContextMenu,
  ContextMenuContent,
  ContextMenuItem,
  ContextMenuTrigger,
} from '@/components/ui/goop/context-menu';
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from '@/components/ui/goop/dropdown-menu';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';

const ACTIONS = [
  { id: 'share', words: 'Copy link' },
  { id: 'delete', words: 'Delete note' },
];

function NoteRow({ onAction }: { onAction: (id: string) => void }) {
  return (
    <ContextMenu>
      <ContextMenuTrigger asChild>
        <div>
          Ridge transect
          <DropdownMenu>
            <DropdownMenuTrigger asChild>
              <IconButton aria-label="Note actions">
                <IconButtonIcon icon="ellipsis" />
              </IconButton>
            </DropdownMenuTrigger>
            <DropdownMenuContent>
              {ACTIONS.map((a) => (
                <DropdownMenuItem key={a.id} onSelect={() => onAction(a.id)}>
                  {a.words}
                </DropdownMenuItem>
              ))}
            </DropdownMenuContent>
          </DropdownMenu>
        </div>
      </ContextMenuTrigger>
      <ContextMenuContent>
        {ACTIONS.map((a) => (
          <ContextMenuItem key={a.id} onSelect={() => onAction(a.id)}>
            {a.words}
          </ContextMenuItem>
        ))}
      </ContextMenuContent>
    </ContextMenu>
  );
}
```

- Fits: list, board: row.
- Also known as: Right-click menu, Long-press menu, Row actions menu.
- Never put an action in the context menu alone: a right-click, a long press and Shift+F10 are all hidden. Pair it with a visible more-actions IconButton opening a DropdownMenu of the same rows: one array mapped into both.

## API reference

### Parts

- `ContextMenuTrigger` — The area that opens the menu
- `ContextMenuPortal` — The portal a menu's content goes through (`ContextMenuContent` writes its own)
- `ContextMenuContent` — The menu's panel (`role="menu"`, named by `aria-label`), its corner at the pointer; by the keys, below the row (above it when the room is short)
- `ContextMenuGroup` — A group of rows (`role="group"`), named by a `ContextMenuLabel` inside it
- `ContextMenuLabel` — A heading over a group of rows
- `ContextMenuShortcut` — A row's key hint
- `ContextMenuItem` — One row (`role="menuitem"`)
- `ContextMenuCheckboxItem` — A row that turns a setting on or off (`role="menuitemcheckbox"`)
- `ContextMenuRadioGroup` — A choice of one among its rows
- `ContextMenuRadioItem` — One row of a `ContextMenuRadioGroup` (`role="menuitemradio"`)
- `ContextMenuSeparator` — A hairline between two groups of rows (`role="separator"`), the panel's full width
- `ContextMenuSub` — A sub menu's root
- `ContextMenuSubTrigger` — The row that opens a sub menu
- `ContextMenuSubContent` — A sub menu's panel (`role="menu"`), the menu's skin, beside its row at its inline end and 4 px off the menu's panel (7 px off the row, the dropdown menu's sub menu's gap), its first row level with that row (3 px up, the panel's own inset)

### ContextMenuCheckboxItem

A row that turns a setting on or off (`role="menuitemcheckbox"`).

```tsx
import { ContextMenuCheckboxItem } from '@/components/ui/goop/context-menu';
```

### Options

- icon?: IconName — A pack icon's name, drawn in the 16 px box before the row's words; left out, the row draws no icon.

### ContextMenuContent

The menu's panel (`role="menu"`, named by `aria-label`), its corner at the pointer; by the keys, below the row (above it when the room is short).

```tsx
import { ContextMenuContent } from '@/components/ui/goop/context-menu';
```

### Options

- container?: HTMLElement | null — Where the layer is portalled; the end of `<body>` when left out.

### ContextMenuGroup

A group of rows (`role="group"`), named by a `ContextMenuLabel` inside it.

```tsx
import { ContextMenuGroup } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuItem

One row (`role="menuitem"`).

```tsx
import { ContextMenuItem } from '@/components/ui/goop/context-menu';
```

### Options

- icon?: IconName — A pack icon's name, drawn in the 16 px box before the row's words; left out, the row draws no icon.
- variant?: 'default' | 'destructive' = 'default' — `destructive`: the row that deletes or cannot be undone — the dropdown menu's red row: its words in the theme's red, its icon in the lighter coral, a pale red wash under the pointer and the keys; it picks, closes and fades when disabled as any row.

### ContextMenuLabel

A heading over a group of rows.

```tsx
import { ContextMenuLabel } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuPortal

The portal a menu's content goes through (`ContextMenuContent` writes its own).

```tsx
import { ContextMenuPortal } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuRadioGroup

A choice of one among its rows.

```tsx
import { ContextMenuRadioGroup } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuRadioItem

One row of a `ContextMenuRadioGroup` (`role="menuitemradio"`).

```tsx
import { ContextMenuRadioItem } from '@/components/ui/goop/context-menu';
```

### Options

- icon?: IconName — A pack icon's name, drawn in the 16 px box before the row's words; left out, the row draws no icon.

### ContextMenuSeparator

A hairline between two groups of rows (`role="separator"`), the panel's full width.

```tsx
import { ContextMenuSeparator } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuShortcut

A row's key hint.

```tsx
import { ContextMenuShortcut } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuSubContent

A sub menu's panel (`role="menu"`), the menu's skin, beside its row at its inline end and 4 px off the menu's panel (7 px off the row, the dropdown menu's sub menu's gap), its first row level with that row (3 px up, the panel's own inset).

```tsx
import { ContextMenuSubContent } from '@/components/ui/goop/context-menu';
```

### Options

- container?: HTMLElement | null — Where the layer is portalled; the end of `<body>` when left out.

### ContextMenuSubTrigger

The row that opens a sub menu.

```tsx
import { ContextMenuSubTrigger } from '@/components/ui/goop/context-menu';
```

### Options

- icon?: IconName — A pack icon's name, drawn in the 16 px box before the row's words; left out, the row draws no icon.

### ContextMenuSub

A sub menu's root.

```tsx
import { ContextMenuSub } from '@/components/ui/goop/context-menu';
```

### Options

### ContextMenuTrigger

The area that opens the menu.

```tsx
import { ContextMenuTrigger } from '@/components/ui/goop/context-menu';
```

### Options

- Also takes: asChild?: boolean

## Keyboard

- Shift+F10 / ContextMenu: on the focused target: open the menu just below its row at its start edge (above the row where the room below is short), the first row lit, the browser's own menu kept shut
- ArrowDown / ArrowUp: move the lit row, skipping a disabled one
- Home / End: first or last row

## Accessibility

- The behaviour layer under the part answers keys, focus and dismissal: never write your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

Shortened to fit: the data-slot values, what the part already sets; what else went is in agent/ship/manifest.json.

## Related

- [Dropdown menu](/themes/meadow/components/dropdown-menu): A menu of actions opened from its button.
- [Icon button](/themes/meadow/components/icon-button): A button whose one visible label is a pack icon, for toolbars, rows and headers, with a spoken name.
- [Command](/themes/meadow/components/command): A list of actions or options narrowed by typing.
- [Command palette](/themes/meadow/components/command-palette): A window of commands under a search field, opened over the app by a key chord such as Cmd K, to run an action by typing its name.
