Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-context-menu.json --yes

Context menu

Pro

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

This part takes no options of its own: it is set by what you put in it.

When to use

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

When not to use

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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-context-menu.json --yes
PROMPT
Add the Goop Context menu to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import {
  ContextMenu, ContextMenuTrigger, ContextMenuPortal, ContextMenuContent, ContextMenuGroup, ContextMenuLabel, ContextMenuShortcut, ContextMenuItem, ContextMenuCheckboxItem, ContextMenuRadioGroup,
  ContextMenuRadioItem, ContextMenuSeparator, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent,
} from '@/components/ui/goop/context-menu';
import { Card, CardAction, CardText, CardTitle } from '@/components/ui/goop/card';
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '@/components/ui/goop/dropdown-menu';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';

function FileCard() {
  const rows = [
    { label: 'Open', icon: 'file' },
    { label: 'Duplicate', icon: 'copy' },
  ] as const;
  return (
    <ContextMenu>
      <ContextMenuTrigger asChild>
        <Card>
          <CardAction>
            <DropdownMenu>
              <DropdownMenuTrigger asChild>
                <IconButton variant="ghost" aria-label="Actions">
                  <IconButtonIcon icon="dots" />
                </IconButton>
              </DropdownMenuTrigger>
              <DropdownMenuContent aria-label="Actions">
                {rows.map((row) => (
                  <DropdownMenuItem key={row.label} icon={row.icon}>
                    {row.label}
                  </DropdownMenuItem>
                ))}
              </DropdownMenuContent>
            </DropdownMenu>
          </CardAction>
          <CardText>
            <CardTitle>Interview guide for Kvist Bikes</CardTitle>
          </CardText>
        </Card>
      </ContextMenuTrigger>
      <ContextMenuContent aria-label="Actions">
        {rows.map((row) => (
          <ContextMenuItem key={row.label} icon={row.icon}>
            {row.label}
          </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.
  • More on where it goes: context-menu--options.md

API reference

Parts
PartWhat it is
ContextMenuTriggerThe area that opens the menu
ContextMenuPortalThe portal a menu's content goes through (ContextMenuContent writes its own)
ContextMenuContentThe 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)
ContextMenuGroupA group of rows (role="group"), named by a ContextMenuLabel inside it
ContextMenuLabelA heading over a group of rows
ContextMenuShortcutA row's key hint
ContextMenuItemOne row (role="menuitem")
ContextMenuCheckboxItemA row that turns a setting on or off (role="menuitemcheckbox")
ContextMenuRadioGroupA choice of one among its rows
ContextMenuRadioItemOne row of a ContextMenuRadioGroup (role="menuitemradio")
ContextMenuSeparatorA line between groups of rows (role="separator")
ContextMenuSubA sub menu's root
ContextMenuSubTriggerThe row that opens a sub menu
ContextMenuSubContentA sub menu's panel (role="menu"), the menu's skin, beside its row, its first row level with it (the skin's lift, shared with the dropdown's sub menu)

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, in the 16 px box before the row's words.

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, in the 16 px box before the row's words.
  • variant?: 'default' | 'destructive' = 'default' — destructive: the row that deletes or cannot be undone — its words, icon and wash in the theme's red.

ContextMenuLabel

A heading over a group of rows.

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

Options

ContextMenu: every option

TSX
import { ContextMenu } from '@/components/ui/goop/context-menu';

Compose

  • Pair it with a visible more-actions IconButton (dots) opening a DropdownMenu of the same rows: one array mapped into both.

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, in the 16 px box before the row's words.

ContextMenuSeparator

A line between groups of rows (role="separator").

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, its first row level with it (the skin's lift, shared with the dropdown's sub menu).

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, in the 16 px box before the row's words.

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

KeyWhat it does
Shift+F10 ContextMenuOn 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 active, the browser's own menu kept shut
ArrowDown ArrowUpMove the active row, skipping a disabled one
Home EndFirst 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.

goop.so/themes/trail/components/context-menu.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-context-menu.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.