Dropdown Menu
Displays a menu of actions or options that the user can choose from, triggered by a button.
Installation
Anatomy
<DropdownMenu>
<DropdownMenuTrigger />
<DropdownMenuContent>
<DropdownMenuGroup>
<DropdownMenuLabel />
<DropdownMenuItem />
<DropdownMenuItem />
</DropdownMenuGroup>
<DropdownMenuSeparator />
<DropdownMenuSub>
<DropdownMenuSubTrigger />
<DropdownMenuSubContent>
<DropdownMenuGroup>
<DropdownMenuItem />
</DropdownMenuGroup>
</DropdownMenuSubContent>
</DropdownMenuSub>
</DropdownMenuContent>
</DropdownMenu>Examples
Default
A dropdown menu with groups, shortcuts, submenus, and a warning item.
Checkbox Items
Use DropdownMenuCheckboxItem for toggling options on and off.
API Reference
DropdownMenu
The root component. Wraps the trigger and content.
DropdownMenuTrigger
The element that toggles the dropdown menu.
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | - | Merges props onto the child element instead of rendering a wrapper. |
DropdownMenuContent
The popover panel that appears when the menu is open.
| Prop | Type | Default | Description |
|---|---|---|---|
sideOffset | number | 4 | Distance in pixels from the trigger. |
DropdownMenuItem
A single actionable item in the menu. Extends the shared MenuItem props.
| Prop | Type | Default | Description |
|---|---|---|---|
Body | React.ReactNode | - | The label text or content of the item. |
Icon | React.ReactNode | - | An optional leading icon. |
desc | string | - | An optional description below the label. |
variant | "default" | "secondary" | "sidebar" | "warning" | "error" | "default" | The visual style of the item. |
disabled | boolean | - | Whether the item is disabled. |
onSelect | (event: Event) => void | - | Handler called when the item is selected. |
DropdownMenuCheckboxItem
A menu item that can be toggled on and off. Extends DropdownMenuItem props.
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | - | Whether the item is checked. |
onCheckedChange | (checked: boolean) => void | - | Handler called when the checked state changes. |
DropdownMenuLabel
A non-interactive label used to title a group of items.
DropdownMenuSeparator
A visual divider between groups of items.
DropdownMenuShortcut
Displays a keyboard shortcut hint aligned to the right of an item.
DropdownMenuGroup
Groups related menu items together with consistent spacing.
DropdownMenuSub
Wraps a sub-menu trigger and its content.
DropdownMenuSubTrigger
A menu item that opens a sub-menu. Accepts the same props as DropdownMenuItem.
DropdownMenuSubContent
The popover panel for a sub-menu.