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'}}
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 {...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
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.
onClick() => voidClick handler for the trigger button.
onOpenChange(isOpen: boolean) => voidCalled when the menu open state changes.
refRef<HTMLButtonElement>Ref forwarded to the trigger button.
styleCSSPropertiesInline styles applied to the menu surface.

Action item inside a `DropdownMenu`.

PropTypeDefaultDescription
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.