Skip to content

DropdownMenu

Button-triggered menu for grouped actions.

<DropdownMenu
button={{label: 'Actions'}}
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}
/>
<DropdownMenu {...args}>
<DropdownMenuItem icon={Edit} label="Edit" />
<DropdownMenuItem icon={Archive} label="Archive" />
<DropdownMenuItem icon={Trash2} label="Delete" />
</DropdownMenu>
<DropdownMenu
button={{label: 'Actions'}}
alignment="end"
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}
isMenuOpen
menuWidth={240}
offsetY={8}
placement="below"
/>
<DropdownMenu
button={{label: 'Actions'}}
items={[ {description: 'Modify this item', icon: Edit, label: 'Edit'}, {description: 'Move to archive', icon: Archive, label: 'Archive'}, {type: 'divider'}, {description: 'Permanently remove', icon: Trash2, label: 'Delete'}, ]}
/>
<DropdownMenu
button={{label: 'Actions'}}
items={[ { icon: Edit, label: 'Edit', tooltip: 'Change the item title and details.', }, { icon: Archive, label: 'Archive', tooltip: 'Move the item out of active lists without deleting it.', }, {type: 'divider'}, { icon: Trash2, label: 'Delete', tooltip: 'Permanently remove the item.', }, ]}
/>
<DropdownMenu {...args}>
<DropdownMenuItem
endContent={<Kbd keys="mod+e" />}
icon={Edit}
label="Edit"
/>
<DropdownMenuItem
endContent={<Kbd keys="mod+shift+a" />}
icon={Archive}
label="Archive"
/>
<DropdownMenuItem
endContent={<Kbd keys="backspace" />}
icon={Trash2}
label="Delete"
/>
</DropdownMenu>
<DropdownMenu
button={{label: 'Actions'}}
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, isDisabled: true, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, isDisabled: true, label: 'Delete'}, ]}
/>
<DropdownMenu
button={{label: 'Actions'}}
items={[ { items: [ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, ], title: 'Actions', type: 'section', }, { items: [{icon: Trash2, label: 'Delete'}], title: 'Danger', type: 'section', }, ]}
/>
<DropdownMenu
button={{icon: MoreVertical, isIconOnly: true, label: 'More actions'}}
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}
/>
<div style={{display: 'flex', gap: '1rem'}}>
<DropdownMenu
button={{label: 'Small', size: 'sm'}}
items={[
{icon: Edit, label: 'Edit'},
{icon: Archive, label: 'Archive'},
{type: 'divider'},
{icon: Trash2, label: 'Delete'},
]}
/>
<DropdownMenu
button={{label: 'Medium'}}
items={[
{icon: Edit, label: 'Edit'},
{icon: Archive, label: 'Archive'},
{type: 'divider'},
{icon: Trash2, label: 'Delete'},
]}
/>
<DropdownMenu
button={{label: 'Large', size: 'lg'}}
items={[
{icon: Edit, label: 'Edit'},
{icon: Archive, label: 'Archive'},
{type: 'divider'},
{icon: Trash2, label: 'Delete'},
]}
/>
</div>
<DropdownMenu
button={{label: 'Actions', variant: 'ghost'}}
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, ]}
/>
<DropdownMenu
button={{ endContent: <Icon icon={Inbox} />, label: 'Inbox', variant: 'secondary', }}
items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}
/>

Button-triggered menu for grouped actions.

PropTypeDefaultDescription
alignment"center" | "start" | "end"'start'Alignment along the placement axis.
buttonDropdownMenuButtonPropsTrigger button props.
childrenReactNodeCompound menu content (alternative to items).
classNamestringAdditional CSS class names applied to the menu surface.
data-testidstringTest ID applied to the trigger button.
hasAutoFocusbooleantrueWhether to auto-focus the first menu item on open.
hasChevronbooleantrueWhether to show a chevron on the trigger button.
isMenuOpenbooleanControlled open state.
itemsReadonlyArray<DropdownMenuOption>Data-driven menu items.
menuWidthnumber | stringWidth of the menu surface.
offsetXnumberGap in pixels between the menu and its trigger along the inline axis.
offsetYnumberGap in pixels between the menu and its trigger along the block axis.
onClick() => voidClick handler for the trigger button.
onOpenChange(isOpen: boolean) => voidCalled when the menu open state changes.
placement"start" | "end" | "above" | "below"'below'Position relative to the trigger.
refRef<HTMLButtonElement>Ref forwarded to the trigger button.
styleCSSPropertiesInline styles applied to the menu surface.

Action item inside a `DropdownMenu`.

PropTypeDefaultDescription
aria-keyshortcutsAriaAttributes['aria-keyshortcuts']Keyboard shortcuts that activate the menu item.
classNamestringAdditional CSS class names applied to the item.
data-testidstringTest ID applied to the item.
descriptionReactNodeSupporting text shown below the label.
endContentReactNodeTrailing content.
iconIconComponentIcon rendered before the label.
isDisabledbooleanfalseWhether the item is disabled.
label*stringItem label.
onClick() => voidCalled when the item is selected.
refRef<HTMLButtonElement>Ref forwarded to the item button.
styleCSSPropertiesInline styles applied to the item.
tooltipReactNodeTooltip content shown when the item is hovered or focused.