Search

Find a component, token or page

Base · Overlays

Dropdown menu

A list of actions that opens from a button.

HTML / JSPlannedReactStableReact NativeDraftSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed

Props

tsx
import { ChevronDownIcon, CopyIcon, PencilIcon, PrinterIcon, XCircleIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuGroup,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"

<DropdownMenu>
  <DropdownMenuTrigger render={<Button variant="outline" />}>
    Actions
    <ChevronDownIcon data-icon="inline-end" />
  </DropdownMenuTrigger>
  <DropdownMenuContent>
    <DropdownMenuGroup>
      <DropdownMenuLabel>Shipment SH-20418</DropdownMenuLabel>
      <DropdownMenuItem>
        <PencilIcon />
        Edit details
        <DropdownMenuShortcut>⌘E</DropdownMenuShortcut>
      </DropdownMenuItem>
      <DropdownMenuItem>
        <CopyIcon />
        Duplicate
        <DropdownMenuShortcut>⌘D</DropdownMenuShortcut>
      </DropdownMenuItem>
      <DropdownMenuItem>
        <PrinterIcon />
        Print label
      </DropdownMenuItem>
    </DropdownMenuGroup>
    <DropdownMenuSeparator />
    <DropdownMenuItem variant="destructive">
      <XCircleIcon />
      Cancel shipment
    </DropdownMenuItem>
  </DropdownMenuContent>
</DropdownMenu>

Overview

A dropdown menu collects the actions for one object or one area behind a single button. Items can be grouped, carry shortcuts, open submenus, or act as checkboxes and radio options.

When to use

  • For the secondary actions on a row, card or page, behind a “More” or “Actions” button.
  • For account and workspace menus.
  • When there are more actions than fit in a row of buttons.

When not to use

  • To pick a value in a form: use a Select or Combobox.
  • For actions on whatever the user right-clicks: use a Context menu, and offer the same actions in a visible menu as well.
  • For the persistent menus of a desktop-style application: use a Menubar.
  • To search across many commands: use a Command palette.
  • For the one or two main actions of a view: show them as Buttons.

Anatomy

  1. Trigger

    The button that opens the menu.

  2. Content

    The floating list. It is at least as wide as the trigger.

  3. Group and label

    A set of related items with an optional heading. A label must sit inside a group.

  4. Item

    An action. Can hold an icon, a shortcut, and use the destructive variant.

  5. Checkbox and radio items

    Items that toggle a setting or choose one of several.

  6. Submenu

    An item that opens a nested menu to the side.

  7. Separator

    A line between groups.

Props

The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).

PropTypeDefaultDescription
side"bottom" | "top" | "left" | "right"bottomThe side of the trigger the menu opens on. Set on DropdownMenuContent.
align"start" | "center" | "end"startHow the menu lines up with the trigger along that side.
labelstringActionsThe trigger text. Passed as children of DropdownMenuTrigger.
sideOffsetnumber4Gap between the trigger and the menu, in pixels.
onOpenChangefunction–Called when the menu opens or closes. Set on the root.

States

Closed
Only the trigger is rendered.
Open
The menu fades and scales in. The trigger shows its expanded style.
Item highlighted
The item under the pointer or keyboard focus has a muted background.
Item disabled
Dimmed and cannot be activated.

Accessibility

Role: menu

KeysAction
Enter/Space/Arrow DownOn the trigger, opens the menu and highlights the first item.
Arrow UpOn the trigger, opens the menu and highlights the last item.
Arrow Down/Arrow UpMoves the highlight between items.
Home/EndHighlights the first or last item.
Enter/SpaceActivates the highlighted item and closes the menu.
Arrow Right/Arrow LeftOpens a submenu, or closes it and returns to its parent.
A–ZHighlights the next item that starts with the typed characters.
EscapeCloses the menu and returns focus to the trigger.
  • The trigger exposes aria-haspopup and aria-expanded.
  • An icon-only trigger needs an accessible name, such as “Shipment actions”.
  • Put destructive items last and separate them from the rest.

Design tokens

Change any of these in Foundations and this component follows, in every language.

Platform notes

HTML / JS
Planned
Not built in HTML / JS yet.
React
Stable
Matches the contract with no platform differences.
React Native
Draft
Prop-driven: pass `items`. Anchored to the trigger on wide windows and an action sheet on phones; shortcuts show on wide windows only, and submenus are omitted.
Swift (SwiftUI)
Planned
Not built in Swift yet.
Godot
Planned
Not built in Godot yet.
Vue
Draft
Usage snippet only; same props and behavior as the React component.
Svelte
Draft
Usage snippet only; same props and behavior as the React component.
Solid
Draft
Usage snippet only; same props and behavior as the React component.

Related