--- title: Dropdown Menu description: Displays a menu to the user — such as a set of actions or functions — triggered by a button. featured: true base: aria component: true links: doc: https://react-aria.adobe.com/Menu api: https://react-aria.adobe.com/Menu#api --- ## Installation Command Manual ```bash npx shadcn@latest add dropdown-menu ``` Install the following dependencies: ```bash npm install react-aria-components ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx showLineNumbers import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" ``` ```tsx showLineNumbers My Account Profile Billing Team Subscription ``` ## Composition Use the following composition to build a `DropdownMenu`: ```text DropdownMenuTrigger ├── Button └── DropdownMenu ├── DropdownMenuGroup │ ├── DropdownMenuLabel │ ├── DropdownMenuItem │ └── DropdownMenuItem ├── DropdownMenuSeparator ├── DropdownMenuGroup │ ├── DropdownMenuLabel │ ├── DropdownMenuItem │ └── DropdownMenuItem └── DropdownMenuSub ├── DropdownMenuSubTrigger └── DropdownMenuSubContent └── DropdownMenuGroup ├── DropdownMenuLabel ├── DropdownMenuItem └── DropdownMenuItem ``` ## Basic A basic dropdown menu with labels and separators. ## Submenu Use `DropdownMenuSub` to nest secondary actions. ## Shortcuts Add `DropdownMenuShortcut` to show keyboard hints. ## Icons Combine icons with labels for quick scanning. ## Checkboxes Use `selectionMode="multiple"` for toggles. ## Checkboxes Icons Add icons to checkbox items. ## Radio Group Use `selectionMode="single"` for exclusive choices. ## Radio Icons Show radio options with icons. ## Destructive Use `variant="destructive"` for irreversible actions. ## Avatar An account switcher dropdown triggered by an avatar. ## Complex A richer example combining groups, icons, and submenus. ## RTL To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl). ## API Reference See the [React Aria documentation](https://react-aria.adobe.com/Menu) for the full API reference.