Base · Overlays
Dropdown menu
A list of actions that opens from a button.
Props
import { ChevronDownIcon, CopyIcon, PencilIcon, PrinterIcon, XCircleIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
<DropdownMenu>
<DropdownMenuTrigger render={<Button variant="outline" />}>
Actions
<ChevronDownIcon data-icon="inline-end" />
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuGroup>
<DropdownMenuLabel>Shipment SH-20418</DropdownMenuLabel>
<DropdownMenuItem>
<PencilIcon />
Edit details
<DropdownMenuShortcut>⌘E</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
<CopyIcon />
Duplicate
<DropdownMenuShortcut>⌘D</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuItem>
<PrinterIcon />
Print label
</DropdownMenuItem>
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">
<XCircleIcon />
Cancel shipment
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>Overview
A dropdown menu collects the actions for one object or one area behind a single button. Items can be grouped, carry shortcuts, open submenus, or act as checkboxes and radio options.
When to use
- For the secondary actions on a row, card or page, behind a “More” or “Actions” button.
- For account and workspace menus.
- When there are more actions than fit in a row of buttons.
When not to use
- To pick a value in a form: use a Select or Combobox.
- For actions on whatever the user right-clicks: use a Context menu, and offer the same actions in a visible menu as well.
- For the persistent menus of a desktop-style application: use a Menubar.
- To search across many commands: use a Command palette.
- For the one or two main actions of a view: show them as Buttons.
Anatomy
Trigger
The button that opens the menu.
Content
The floating list. It is at least as wide as the trigger.
Group and label
A set of related items with an optional heading. A label must sit inside a group.
Item
An action. Can hold an icon, a shortcut, and use the destructive variant.
Checkbox and radio items
Items that toggle a setting or choose one of several.
Submenu
An item that opens a nested menu to the side.
Separator
A line between groups.
Props
The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).
| Prop | Type | Default | Description |
|---|---|---|---|
| side | "bottom" | "top" | "left" | "right" | bottom | The side of the trigger the menu opens on. Set on DropdownMenuContent. |
| align | "start" | "center" | "end" | start | How the menu lines up with the trigger along that side. |
| label | string | Actions | The trigger text. Passed as children of DropdownMenuTrigger. |
| sideOffset | number | 4 | Gap between the trigger and the menu, in pixels. |
| onOpenChange | function | – | Called when the menu opens or closes. Set on the root. |
States
- Closed
- Only the trigger is rendered.
- Open
- The menu fades and scales in. The trigger shows its expanded style.
- Item highlighted
- The item under the pointer or keyboard focus has a muted background.
- Item disabled
- Dimmed and cannot be activated.
Accessibility
Role: menu
| Keys | Action |
|---|---|
| Enter/Space/Arrow Down | On the trigger, opens the menu and highlights the first item. |
| Arrow Up | On the trigger, opens the menu and highlights the last item. |
| Arrow Down/Arrow Up | Moves the highlight between items. |
| Home/End | Highlights the first or last item. |
| Enter/Space | Activates the highlighted item and closes the menu. |
| Arrow Right/Arrow Left | Opens a submenu, or closes it and returns to its parent. |
| A–Z | Highlights the next item that starts with the typed characters. |
| Escape | Closes the menu and returns focus to the trigger. |
- The trigger exposes aria-haspopup and aria-expanded.
- An icon-only trigger needs an accessible name, such as “Shipment actions”.
- Put destructive items last and separate them from the rest.
Design tokens
Change any of these in Foundations and this component follows, in every language.
Platform notes
- HTML / JS
- Planned
- Not built in HTML / JS yet.
- React
- Stable
- Matches the contract with no platform differences.
- React Native
- Draft
- Prop-driven: pass `items`. Anchored to the trigger on wide windows and an action sheet on phones; shortcuts show on wide windows only, and submenus are omitted.
- Swift (SwiftUI)
- Planned
- Not built in Swift yet.
- Godot
- Planned
- Not built in Godot yet.
- Vue
- Draft
- Usage snippet only; same props and behavior as the React component.
- Svelte
- Draft
- Usage snippet only; same props and behavior as the React component.
- Solid
- Draft
- Usage snippet only; same props and behavior as the React component.