Dropdown Menu
A list of actions in a dropdown, enhanced with keyboard navigation.
Installation
pnpm dlx shadcn@latest add @lumi-ui/dropdown-menu
Anatomy
<Dropdown>
<DropdownMenuTrigger />
<DropdownMenuContent>
<DropdownMenuItem />
<DropdownMenuLinkItem />
<DropdownMenuItem>
<DropdownMenuShortcut />
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuGroupLabel />
</DropdownMenuGroup>
<DropdownMenuRadioGroup>
<DropdownMenuRadioItemContent />
</DropdownMenuRadioGroup>
<DropdownMenuCheckboxItemContent />
<DropdownMenuSubMenu>
<DropdownMenuSubMenuTriggerGroup />
<DropdownMenuSubMenuContent>
{/* Submenu items */}
</DropdownMenuSubMenuContent>
</DropdownMenuSubMenu>
</DropdownMenuContent>
</Dropdown>Basic Usage
Features
Matching the Trigger Width
With Arrow
Group labels
Nested menu
Checkbox items
Radio items
Cookbook
Style Trigger when open
Open on hover
Close on click
Navigate to another page
DropdownMenuLinkItem renders a by default. Use render prop to render link based on your framework.
Open a dialog
Control the dialog state and open it imperatively using the onClick handler on the menu item.
Detached triggers
Multiple triggers
API Reference
DropdownMenuContent
A high-level container component that combines the DropdownMenuPortal, DropdownMenuPositioner, and DropdownMenuPopup into a single styled element for the dropdown content.
DropdownMenuCheckboxItemContent
A high-level checkbox item component that combines the CheckboxItem and CheckboxItemIndicator into a single styled element with configurable icon positioning.
DropdownMenuRadioItemContent
A high-level radio item component that combines the RadioItem and RadioItemIndicator into a single styled element with configurable icon positioning.
DropdownMenuSubMenuTriggerGroup
A composite trigger component that renders the trigger content and a chevron icon.
DropdownMenuSubMenuContent
A composite content component for submenus.