DropdownMenu
Button-triggered menu for grouped actions.
Examples
Section titled “Examples”Data Driven
Section titled “Data Driven”<DropdownMenu button={{label: 'Actions'}} items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}/>Compound
Section titled “Compound”<DropdownMenu {...args}> <DropdownMenuItem icon={Edit} label="Edit" /> <DropdownMenuItem icon={Archive} label="Archive" /> <DropdownMenuItem icon={Trash2} label="Delete" /></DropdownMenu>With Descriptions
Section titled “With Descriptions”<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'}, ]}/>With Shortcuts
Section titled “With Shortcuts”<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>With Disabled Items
Section titled “With Disabled Items”<DropdownMenu button={{label: 'Actions'}} items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, isDisabled: true, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, isDisabled: true, label: 'Delete'}, ]}/>Sections
Section titled “Sections”Actions
Danger
<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', }, ]}/>Icon Only Trigger
Section titled “Icon Only Trigger”More actions
<DropdownMenu button={{icon: MoreVertical, isIconOnly: true, label: 'More actions'}} items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, {type: 'divider'}, {icon: Trash2, label: 'Delete'}, ]}/>Size Variants
Section titled “Size Variants”<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>Ghost Trigger
Section titled “Ghost Trigger”<DropdownMenu button={{label: 'Actions', variant: 'ghost'}} items={[ {icon: Edit, label: 'Edit'}, {icon: Archive, label: 'Archive'}, ]}/>Trigger With End Content
Section titled “Trigger With End Content”<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'}, ]}/>DropdownMenu
Section titled “DropdownMenu”Button-triggered menu for grouped actions.
| Prop | Type | Default | Description |
|---|---|---|---|
button | DropdownMenuButtonProps | — | Trigger button props. |
children | ReactNode | — | Compound menu content (alternative to items). |
className | string | — | Additional CSS class names applied to the menu surface. |
data-testid | string | — | Test ID applied to the trigger button. |
hasAutoFocus | boolean | true | Whether to auto-focus the first menu item on open. |
hasChevron | boolean | true | Whether to show a chevron on the trigger button. |
isMenuOpen | boolean | — | Controlled open state. |
items | ReadonlyArray<DropdownMenuOption> | — | Data-driven menu items. |
menuWidth | number | string | — | Width of the menu surface. |
onClick | () => void | — | Click handler for the trigger button. |
onOpenChange | (isOpen: boolean) => void | — | Called when the menu open state changes. |
ref | Ref<HTMLButtonElement> | — | Ref forwarded to the trigger button. |
style | CSSProperties | — | Inline styles applied to the menu surface. |
DropdownMenuItem
Section titled “DropdownMenuItem”Action item inside a `DropdownMenu`.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS class names applied to the item. |
data-testid | string | — | Test ID applied to the item. |
description | ReactNode | — | Supporting text shown below the label. |
endContent | ReactNode | — | Trailing content. |
icon | IconComponent | — | Icon rendered before the label. |
isDisabled | boolean | false | Whether the item is disabled. |
label* | string | — | Item label. |
onClick | () => void | — | Called when the item is selected. |
ref | Ref<HTMLButtonElement> | — | Ref forwarded to the item button. |
style | CSSProperties | — | Inline styles applied to the item. |