--- title: Dropdown Menu description: Displays a menu to the user — such as a set of actions or functions — triggered by a button. featured: true component: true links: doc: https://www.radix-ui.com/docs/primitives/components/dropdown-menu api: https://www.radix-ui.com/docs/primitives/components/dropdown-menu#api-reference --- ## Installation CLI Manual ```bash npx shadcn@latest add dropdown-menu ``` Install the following dependencies: ```bash npm install @radix-ui/react-dropdown-menu ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" ``` ```tsx Open My Account Profile Billing Team Subscription ``` ## Examples ### Checkboxes ### Radio Group ## Changelog ### 2024-10-16 Classes for icons Added `gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0` to the `DropdownMenuItem` to automatically style icon inside the dropdown menu item. Add the following classes to the `DropdownMenuItem` in your `dropdown-menu.tsx` file. ```diff showLineNumbers title="dropdown-menu.tsx" const DropdownMenuItem = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef & { inset?: boolean } >(({ className, inset, ...props }, ref) => ( )) ``` ### 2024-10-25 Classes for `` Added `gap-2 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0` to the `` to automatically style icon inside. Add the following classes to the `cva` call in your `dropdown-menu.tsx` file. ```tsx title="dropdown-menu.tsx" {/* ... */} ```