Dropdown Menu

Click-triggered menu attached to a button. Supports items, separators, labels, shortcuts, checkbox and radio items, and nested submenus.

Demo

A dropdown menu with icons, shortcuts and sub menu items.

Dark previewReplay previewOpen in new tab

Usage

Import the parts you need from the component's folder.

ts
import {
  DropdownMenu,
  DropdownMenuTrigger,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuLabel,
  DropdownMenuSeparator,
  DropdownMenuShortcut,
  DropdownMenuGroup,
  DropdownMenuCheckboxItem,
  DropdownMenuRadioGroup,
  DropdownMenuRadioItem,
  DropdownMenuSub,
  DropdownMenuSubTrigger,
  DropdownMenuSubContent,
  DropdownMenuPortal,
} from "@/components/ui/dropdown-menu";

Basic

A basic dropdown menu with labels and separators.

Dark previewReplay previewOpen in new tab

Shortcuts

Add DropdownMenuShortcut to show keyboard hints.

Dark previewReplay previewOpen in new tab

Icons

Combine icons with labels for quick scanning.

Dark previewReplay previewOpen in new tab

Checkboxes

Use DropdownMenuCheckboxItem for toggles.

Dark previewReplay previewOpen in new tab

Checkboxes Icons

Add icons to checkbox items.

Dark previewReplay previewOpen in new tab

Radio Group

Use DropdownMenuRadioGroup for exclusive choices.

Dark previewReplay previewOpen in new tab

Radio Icons

Show radio options with icons.

Dark previewReplay previewOpen in new tab

Destructive

Use variant="destructive" for irreversible actions.

Dark previewReplay previewOpen in new tab

Avatar

An account switcher dropdown triggered by an avatar.

Dark previewReplay previewOpen in new tab

Complex

A richer example combining groups, icons, and submenus.

Dark previewReplay previewOpen in new tab

RTL

Pass dir="rtl" to flip the menu's alignment and submenu direction.

Dark previewReplay previewOpen in new tab

API Reference

DropdownMenu

PropTypeDefaultDescription
openboolean—Open state. Supports v-model:open.
modalbooleantrueTrap focus and dim background when open.
EventDescription
update:openFires when the menu opens or closes. Enables v-model:open.

DropdownMenuTrigger

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto the child element instead of a button.

DropdownMenuContent

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"Anchor side.
align"start" | "center" | "end""center"Alignment along the side.
sideOffsetnumber4Gap from the trigger in px.
EventDescription
close-auto-focusFires when focus returns to the trigger after closing.

DropdownMenuItem

PropTypeDefaultDescription
variant"default" | "destructive""default"destructive tints the item red for delete-style actions.
disabledbooleanfalseBlock selection.
insetbooleanfalseExtra left padding to align with icon items.
EventDescription
selectFires when the item is chosen.

DropdownMenuCheckboxItem / DropdownMenuRadioItem

PropTypeDefaultDescription
modelValueboolean | string—Item state. Supports v-model.
EventDescription
update:modelValueFires when the checkbox toggles or the radio value changes.

DropdownMenuSub / DropdownMenuSubTrigger / DropdownMenuSubContent

PropTypeDefaultDescription
insetbooleanfalse(SubTrigger) Align with icon items. Submenu opens on hover or right-arrow.

DropdownMenuLabel

PropTypeDefaultDescription
insetbooleanfalseAlign the section label with inset items.

Accessibility

Keyboard shortcuts and ARIA behavior.

Shortcut Description
SpaceOpens the menu from the trigger, or activates the focused item.
EnterOpens the menu from the trigger, or activates the focused item.
↑Moves focus to the previous item.
↓Moves focus to the next item.
→Opens a submenu when focus is on a submenu trigger.
←Closes a submenu and returns focus to its trigger.
HomeMoves focus to the first item.
EndMoves focus to the last item.
EscCloses the menu and returns focus to the trigger.
ATyping characters jumps to the matching item (typeahead).
  • Uses a roving tabindex: only one item is tabbable and arrows move focus between items.
  • Menu items use role=menuitem within a role=menu container.