Logobaseui-cn

Dropdown Menu

Displays a menu to the user triggered by a button.

overlayinteractivenavigation
Loading preview...

Installation

npx baseui-cn add dropdown-menu

Usage

import {
  DropdownMenu,
  DropdownMenuTrigger,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuLabel,
  DropdownMenuSub,
  DropdownMenuSubTrigger,
  DropdownMenuSubContent,
  DropdownMenuCheckboxItem,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
} from "@/components/ui/dropdown-menu"
<DropdownMenu>
  <DropdownMenuTrigger>Open</DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuLabel>My Account</DropdownMenuLabel>
    <DropdownMenuSeparator />
    <DropdownMenuItem>Profile</DropdownMenuItem>
    <DropdownMenuItem>Settings</DropdownMenuItem>
    <DropdownMenuSeparator />
    <DropdownMenuItem variant="destructive">Log out</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>

Examples

Basic

A standard dropdown menu.

Loading preview...

With shortcuts

Show keyboard shortcuts with DropdownMenuShortcut.

Loading preview...

Checkboxes

Use DropdownMenuCheckboxItem for toggleable items.

Loading preview...

Radio group

Use DropdownMenuRadioGroup for single-select items.

Loading preview...

Nested menus with DropdownMenuSub.

Loading preview...

API

PropTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Side of the trigger the menu appears on
sideOffsetnumber4Distance in px between the menu and the trigger
align"start" | "center" | "end""start"Alignment of the popup relative to the trigger
alignOffsetnumber0Offset in px along the alignment axis
PropTypeDefaultDescription
variant"default" | "destructive""default"Applies destructive red coloring to the item
insetbooleanAdds left padding so text aligns with icon items

Each of these accepts an inset (boolean) prop that adds left padding to align content with icon-bearing menu items.

API Reference

See the Base UI Menu documentation for the full API reference, including all props, data attributes, and CSS classes.