Skip to content

Overlays

Dropdown menu

Also calledaction menudrop-down menu

A menu of actions that opens next to a trigger button and closes after choosing an action or dismissing it.

How people describe it

  • “list of actions that opens below a button”
  • “small floating list with edit and copy choices”
  • “click more to reveal a vertical list of commands”

Good for

  • Secondary actions for an item
  • Compact groups of commands

Don’t mix it up with

  • Holds general content rather than a keyboard-navigable list of menu commands.

What your library calls it

LIBRARYCALLS IT
shadcn/uiDropdown Menu

Accessibility checklist

  • Use a named trigger with expanded state
  • Support arrow keys and Escape
  • Manage menu focus and return it to the trigger on dismissal

Try it

Open the menu, then use the arrow keys

Open it, then use ↑ ↓ Home End. Esc closes and returns focus.

Prompt

Add a dropdown menu with keyboard navigation and Escape dismissal.

~17 estimated prompt tokensDetailed: ~60 estimated prompt tokens

Rough estimate for prompt text only; actual counts vary by model and context.

"use client";
// Requires the Base UI variant of shadcn/ui dropdown-menu in the consuming project.
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";

export function DocumentMenu({ onRename, onDuplicate }: {
  onRename: () => void;
  onDuplicate: () => void;
}) {
  return (
    <DropdownMenu>
      <DropdownMenuTrigger className="min-h-11 min-w-11 px-4 focus-visible:outline-2 focus-visible:outline-offset-2">Document actions</DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuItem onClick={onRename} className="min-h-11">Rename</DropdownMenuItem>
        <DropdownMenuItem onClick={onDuplicate} className="min-h-11">Duplicate</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  );
}

Used in

Explore website blueprints that use this component.