Skip to content

Dropdown Menu

A menu of actions or options triggered by a button.

API Reference

Installation

pnpm dlx shadcn@latest add @frontal-labs/dropdown-menu

Usage

import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
<DropdownMenu>
  <DropdownMenuTrigger render={<Button variant="outline" />}>Open menu</DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuItem>Profile</DropdownMenuItem>
    <DropdownMenuItem>Settings</DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>

API Reference

Root component. Alias for Menu.Root from Base UI.

The button that opens the menu. Use render to swap in your own trigger.

The popup surface, elevated with shadow-menu and surface-ring. Accepts align, alignOffset, side and sideOffset for positioning.

Also accepts dark (boolean, defaults to true), which renders the surface with the dark palette. Pass dark={false} when it should follow the ambient theme instead: next-themes sets dark on <html> and the portal lands in document.body, inside it, so the menu can pick up the ambient theme once dark is turned off. For a menu opened from a .dark region scoped mid-page, which a portal does escape, rendering into the scoped node is usually the better tool. dark applies .dark to the positioner inside the portal, so the tokens inherit down to the popup and everything within it.

A selectable action. Set variant="destructive" for dangerous actions.

An item with a checked state.

Groups DropdownMenuRadioItem elements so only one can be selected.

A single choice inside a DropdownMenuRadioGroup.

Groups related items.

A non-interactive heading for a group.

A dividing line between groups.

Right-aligned keyboard hint inside an item.

Wraps a nested submenu.

Opens the submenu on hover or keyboard focus.

The submenu popup. Takes the same props as DropdownMenuContent, including dark, and is elevated with the same shadow-menu + surface-ring treatment.

Renders the popup into a portal.

Examples

Checkbox Items

Radio Items