---
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/"
---

# Dropdown menu

A menu of actions, for React and Tailwind CSS. Free, MIT.

Free. Its export: `DropdownMenu`.

## Try it

Open the Inbox menu with a click or the keyboard: "Mark all as read" clears the count on the button, "Show read notices" hides the read ones, the order rows sort the list, the submenu moves the first notice away, and the red row deletes the read ones.

The notices live in the page only.

## When to use

- A menu of actions.
- Also called: dropdown or actions menu.

## When not to use

- For a value, use Select.

## 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 Dropdown menu on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-dropdown-menu
```

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

## Usage

```tsx
import {
  menuSkin, DropdownMenu, DropdownMenuTrigger, DropdownMenuPortal, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuShortcut, DropdownMenuItem, DropdownMenuCheckboxItem,
  DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent,
} from '@/components/ui/goop/dropdown-menu';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';

<DropdownMenu>
  <DropdownMenuTrigger asChild>
    <IconButton variant="ghost" aria-label="Note actions">
      <IconButtonIcon icon="dots" />
    </IconButton>
  </DropdownMenuTrigger>
  <DropdownMenuContent aria-label="Note actions">
    <DropdownMenuItem>Rename</DropdownMenuItem>
    <DropdownMenuItem>Duplicate</DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuCheckboxItem checked>Pinned</DropdownMenuCheckboxItem>
  </DropdownMenuContent>
</DropdownMenu>
```

- Fits: account, list (their recipes).
- height, width, padding, gap, corner, border, background, shadow, text, motion: add no class for these.

## API reference

### Options

- `open?: boolean`
- `defaultOpen?: boolean`
- `onOpenChange?: (open: boolean) => void`
- `modal?: boolean`

- Another example of it: menu-button.md
- State: open (open / defaultOpen / onOpenChange); drawn by data-state=unchecked, data-state=open, data-highlighted, data-disabled

### Parts

- `DropdownMenuTrigger` — The button that opens the menu; takes asChild
- `DropdownMenuPortal` — The portal a menu's content goes through (`DropdownMenuContent` writes its own)
- `DropdownMenuContent` — The menu's panel (`role="menu"`), placed below its trigger at its start, 4 px off, shifting and flipping to stay 8 px inside the window (`collisionPadding`); it portals to the end of `<body>`, or into `container`; its props: dropdown-menu--content.md
- `DropdownMenuGroup` — A group of rows (`role="group"`), named by a `DropdownMenuLabel` inside it
- `DropdownMenuLabel` — A heading over a group of rows
- `DropdownMenuShortcut` — A row's key hint
- `DropdownMenuItem` — One row (`role="menuitem"`); its props: dropdown-menu--item.md
- `DropdownMenuCheckboxItem` — A row that turns a setting on or off (`role="menuitemcheckbox"`); its props: dropdown-menu--checkbox-item.md
- `DropdownMenuRadioGroup` — A choice of one among its rows; also takes value?: string; onValueChange?: (value: string) => void
- `DropdownMenuRadioItem` — One row of a `DropdownMenuRadioGroup` (`role="menuitemradio"`); its props: dropdown-menu--radio-item.md
- `DropdownMenuSeparator` — A line between groups of rows (`role="separator"`)
- `DropdownMenuSub` — A sub menu's root; also takes open?: boolean; defaultOpen?: boolean = false; onOpenChange?: (open: boolean) => void
- `DropdownMenuSubTrigger` — The row that opens a sub menu; its props: dropdown-menu--sub-trigger.md
- `DropdownMenuSubContent` — A sub menu's panel (`role="menu"`), the menu's skin, beside its row, its first row level with it (flipped to the row's other side near the window's edge, still level)
- `menuSkin` — The theme's internal skin table, not a component

### DropdownMenuCheckboxItem

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

```tsx
import { DropdownMenuCheckboxItem } from '@/components/ui/goop/dropdown-menu';
```

### Options

- icon?: IconName — A pack icon's name, in the 16 px box before the row's words.
- Also takes: checked?: boolean | 'indeterminate'; onCheckedChange?: (checked: boolean) => void; disabled?: boolean

### DropdownMenuContent

The menu's panel (`role="menu"`), placed below its trigger at its start, 4 px off, shifting and flipping to stay 8 px inside the window (`collisionPadding`); it portals to the end of `<body>`, or into `container`.

```tsx
import { DropdownMenuContent } from '@/components/ui/goop/dropdown-menu';
```

### Options

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

### DropdownMenuItem

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

```tsx
import { DropdownMenuItem } from '@/components/ui/goop/dropdown-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.
- Also takes: asChild?: boolean; onSelect?: (event: Event) => void; disabled?: boolean

### DropdownMenuRadioItem

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

```tsx
import { DropdownMenuRadioItem } from '@/components/ui/goop/dropdown-menu';
```

### Options

- icon?: IconName — A pack icon's name, in the 16 px box before the row's words.
- Also takes: value: string; disabled?: boolean

### DropdownMenuSubTrigger

The row that opens a sub menu.

```tsx
import { DropdownMenuSubTrigger } from '@/components/ui/goop/dropdown-menu';
```

### Options

- icon?: IconName — A pack icon's name, in the 16 px box before the row's words.
- Also takes: disabled?: boolean

## Keyboard

- Enter: on the trigger: open, the first row active
- Space: on the trigger: open, the first row active
- ArrowDown / ArrowUp: open from the trigger; move the active row

## Accessibility

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

## Motion

- The part sets its own motion: add no transition or animation of 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 else went is in agent/ship/manifest.json.

## Related

- [Select](/themes/trail/components/select): One option from a short closed list.
- [Icon button](/themes/trail/components/icon-button): A button whose only visible label is one icon, for toolbars, rows and headers.
- [Context menu](/themes/trail/components/context-menu): A menu of a target's secondary actions, opened at the pointer.
- [Command](/themes/trail/components/command): A list of actions or options narrowed by typing.
