---
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 opened from its button, 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 opened from its button.
- Also called: dropdown or actions menu.

## 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/meadow-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 { DropdownMenuPortal, DropdownMenuGroup, DropdownMenuDescription, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent } from '@/components/ui/goop/dropdown-menu';

import { useState } from 'react';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import {
  DropdownMenu,
  DropdownMenuCheckboxItem,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuTrigger,
} from '@/components/ui/goop/dropdown-menu';

function NoteMenu({ onDelete }: { onDelete(): void }) {
  const [starred, setStarred] = useState(true);
  const [group, setGroup] = useState('site');
  return (
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <IconButton aria-label="Note menu">
          <IconButtonIcon icon="chevron-down" />
        </IconButton>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuLabel>This note</DropdownMenuLabel>
        <DropdownMenuItem icon="copy">
          Copy
          <DropdownMenuShortcut>⌘D</DropdownMenuShortcut>
        </DropdownMenuItem>
        <DropdownMenuCheckboxItem icon="star" checked={starred} onCheckedChange={setStarred}>
          Starred
        </DropdownMenuCheckboxItem>
        <DropdownMenuRadioGroup aria-label="Group by" value={group} onValueChange={setGroup}>
          <DropdownMenuRadioItem value="site">By site</DropdownMenuRadioItem>
          <DropdownMenuRadioItem value="crew">By crew</DropdownMenuRadioItem>
        </DropdownMenuRadioGroup>
        <DropdownMenuSeparator />
        <DropdownMenuItem icon="trash" variant="destructive" onSelect={onDelete}>
          Remove
        </DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}
```

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

## API reference

### Options

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

- State: open (open / defaultOpen / onOpenChange); drawn by data-state=open, data-highlighted, data-disabled

### Parts

- `DropdownMenuTrigger` — The button that opens the menu
- `DropdownMenuContent` — The menu's panel (`role="menu"`)
- `DropdownMenuPortal` — The portal a menu's panel goes through (`DropdownMenuContent` and `DropdownMenuSubContent` write their own)
- `DropdownMenuGroup` — A group of rows inside a menu's panel, as `role="group"`
- `DropdownMenuShortcut` — A row's key hint
- `DropdownMenuDescription` — A row's caption
- `DropdownMenuItem` — One row (`role="menuitem"`)
- `DropdownMenuCheckboxItem` — A row that turns a setting on or off (`role="menuitemcheckbox"`)
- `DropdownMenuRadioGroup` — A choice of one among its rows (`role="group"`, named by its `aria-label`)
- `DropdownMenuRadioItem` — One row of a `DropdownMenuRadioGroup` (`role="menuitemradio"`)
- `DropdownMenuSeparator` — A hairline between two groups of rows (`role="separator"`), the panel's full width
- `DropdownMenuLabel` — A heading over a group of rows
- `DropdownMenuSub` — A sub menu's root
- `DropdownMenuSubTrigger` — The row that opens a sub menu
- `DropdownMenuSubContent` — A sub menu's panel (`role="menu"`), the menu's own, beside its row and 4 px off the menu's panel (7 px off the row), its first row level with that row (3 px up, the panel's own inset); near the window's edge it flips to the row's other side and stays 8 px inside

### 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, drawn in the 16 px box before the row's words; left out, the row draws no icon.
- Also takes: checked?: boolean | 'indeterminate'; onCheckedChange?: (checked: boolean) => void; disabled?: boolean

### DropdownMenuContent

The menu's panel (`role="menu"`).

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

### Options

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

### DropdownMenuDescription

A row's caption.

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

### Options

### DropdownMenuGroup

A group of rows inside a menu's panel, as `role="group"`.

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

### Options

### DropdownMenuItem

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

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

### Options

- variant: default (default), destructive
- 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.
- Also takes: onSelect?: (event: Event) => void; disabled?: boolean; asChild?: boolean

### DropdownMenuLabel

A heading over a group of rows.

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

### Options

### DropdownMenuPortal

The portal a menu's panel goes through (`DropdownMenuContent` and `DropdownMenuSubContent` write their own).

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

### Options

### DropdownMenuRadioGroup

A choice of one among its rows (`role="group"`, named by its `aria-label`).

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

### Options

- Also takes: value?: string; onValueChange?: (value: string) => void

### 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, drawn in the 16 px box before the row's words; left out, the row draws no icon.
- Also takes: value: string; disabled?: boolean

### DropdownMenuSeparator

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

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

### Options

### DropdownMenuShortcut

A row's key hint.

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

### Options

### DropdownMenuSubContent

A sub menu's panel (`role="menu"`), the menu's own, beside its row and 4 px off the menu's panel (7 px off the row), its first row level with that row (3 px up, the panel's own inset); near the window's edge it flips to the row's other side and stays 8 px inside.

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

### Options

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

### 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, drawn in the 16 px box before the row's words; left out, the row draws no icon.
- Also takes: disabled?: boolean

### DropdownMenuSub

A sub menu's root.

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

### Options

- Also takes: open?: boolean; defaultOpen?: boolean = false; onOpenChange?: (open: boolean) => void

### DropdownMenuTrigger

The button that opens the menu.

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

### Options

- Also takes: asChild?: 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

- [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.
- [Context menu](/themes/meadow/components/context-menu): A menu of a target's secondary actions, opened at the pointer.
- [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.
