Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-dropdown-menu

Dropdown menu

Free

A menu of actions opened from its button, for React and Tailwind CSS. Free, MIT.

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.

Terminal
npx shadcn@4.23.1 add @goop/meadow-dropdown-menu
PROMPT
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
OptionTypeWhat it does
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
PartWhat it is
DropdownMenuTriggerThe button that opens the menu
DropdownMenuContentThe menu's panel (role="menu")
DropdownMenuPortalThe portal a menu's panel goes through (DropdownMenuContent and DropdownMenuSubContent write their own)
DropdownMenuGroupA group of rows inside a menu's panel, as role="group"
DropdownMenuShortcutA row's key hint
DropdownMenuDescriptionA row's caption
DropdownMenuItemOne row (role="menuitem")
DropdownMenuCheckboxItemA row that turns a setting on or off (role="menuitemcheckbox")
DropdownMenuRadioGroupA choice of one among its rows (role="group", named by its aria-label)
DropdownMenuRadioItemOne row of a DropdownMenuRadioGroup (role="menuitemradio")
DropdownMenuSeparatorA hairline between two groups of rows (role="separator"), the panel's full width
DropdownMenuLabelA heading over a group of rows
DropdownMenuSubA sub menu's root
DropdownMenuSubTriggerThe row that opens a sub menu
DropdownMenuSubContentA 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

KeyWhat it does
EnterOn the trigger: open, the first row active
SpaceOn the trigger: open, the first row active
ArrowDown ArrowUpOpen 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.

goop.so/themes/meadow/components/dropdown-menu.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-dropdown-menu

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.