Dropdown Menu

Use DropdownMenu to collect commands behind a button, including optional checked settings and destructive actions.

Preview

Workspace actions

Explore page commands, a controlled depth-guide checkbox, a theme submenu with radio choices, and a destructive workspace item.

Installation

New to this Registry? Complete the base setup before continuing.

npx shadcn@latest add @neumorphism-ui/dropdown-menu

Install the shared base once, then add components and their dependencies with the CLI.

Workspace actions

npx shadcn@latest add @neumorphism-ui/button @neumorphism-ui/dropdown-menu
Registry JSON

Usage

Pair DropdownMenuTrigger with DropdownMenuContent. Group related items and connect checkbox or radio items to application state when they represent a preference.

"use client";

import { useState } from "react";
import { Button } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";

export default function Example() {
  const [visible, setVisible] = useState(true);
  return (
    <div>
      <DropdownMenu>
        <DropdownMenuTrigger render={<Button />}>View options</DropdownMenuTrigger>
        <DropdownMenuContent>
          <DropdownMenuCheckboxItem checked={visible} onCheckedChange={setVisible}>Show details</DropdownMenuCheckboxItem>
        </DropdownMenuContent>
      </DropdownMenu>
      {visible && <p>Project details are visible.</p>}
    </div>
  );
}

API Reference

A complete composable API built on Base UI Menu. Combines regular items, checkboxes, radio groups, labels, separators, shortcuts, and nested submenus on one surface.

ComponentPropTypeDefaultDescription
DropdownMenuopen / defaultOpenbooleanfalseThe controlled open state or initial uncontrolled open state.
DropdownMenuonOpenChange(open: boolean) => void—Called when the menu open state changes.
DropdownMenuTriggerrenderReactElement | (props, state) => ReactElement—Composes trigger behavior onto a button or link.
DropdownMenuContentside / align"top" | "right" | "bottom" | "left" / "start" | "center" | "end""bottom" / "start"Positions the popup relative to the trigger.
DropdownMenuContentsideOffsetnumber8The distance between the trigger and popup.
DropdownMenuItemvariant"default" | "destructive""default"Selects the regular or destructive action style.
DropdownMenuItem / LabelinsetbooleanfalseAligns text with rows that include an indicator.
DropdownMenuCheckboxItemcheckedboolean—The controlled state of a checkbox item.
DropdownMenuCheckboxItemonCheckedChange(checked) => void—Called when a checkbox item state changes.

Accessibility

  • 01

    Base UI handles Arrow key navigation, Home, End, typeahead, closing with Escape, and focus restoration.

  • 02

    Give each DropdownMenuItem a clear command label, and distinguish destructive actions in the wording as well as with variant.

  • 03

    Use checked with onCheckedChange to manage CheckboxItem state explicitly.