Dropdown Menu
A list of actions or options that opens from a button. Items are roomy, their corners follow the menu's, and the chosen option is filled in rather than just ticked.
Install
npx shadcn@latest add @nelumbo/dropdown-menuActions
Icons on the left, shortcuts on the right, a submenu, and a destructive action set apart at the end. Arrow keys move, typing jumps to an item, Escape closes.
Nothing chosen yet
Options
Checkbox items toggle without closing the menu; a radio group picks one, and the chosen row fills in with the tonal container.
Account menu
A header row made from plain markup, then grouped items.
Usage
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuShortcut, DropdownMenuSeparator } from "@/components/ui/dropdown-menu"<DropdownMenu> <DropdownMenuTrigger asChild> <IconButton icon="more_vert" label="More" /> </DropdownMenuTrigger> <DropdownMenuContent align="end"> <DropdownMenuItem> <Icon name="edit" /> Rename <DropdownMenuShortcut>F2</DropdownMenuShortcut> </DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem variant="destructive"> <Icon name="delete" /> Delete </DropdownMenuItem> </DropdownMenuContent></DropdownMenu>Props
Everything else is Radix Dropdown Menu (open, onOpenChange, modal, onSelect, checked, value…).
| Prop | Type | Default | Notes |
|---|---|---|---|
DropdownMenuItem variant | "default" | "destructive" | "default" | |
inset | boolean | false | Item, Label, SubTrigger: align with items that have an icon |
DropdownMenuContent sideOffset | number | 6 |