Join our Discord Community

Dropdown Menu

A versatile dropdown menu component for actions, navigation, and settings. Built on Radix UI with customizable positioning and rich interactions.

Need a clean way to organize actions without cluttering your interface? Dropdown menus give users quick access to contextual options right where they need them.

Feature-rich dropdown

A comprehensive dropdown with groups, shortcuts, and submenus:

Loading component...

Built on Radix UI Dropdown Menu with full keyboard navigation, screen reader support, and collision detection for smart positioning.

npx shadcn@latest add dropdown-menu

Why dropdown menus work so well

They organize complex actions into digestible, contextual groups:

  • Space efficient - Pack many options into a compact, discoverable menu
  • Contextual actions - Surface relevant options based on current selection
  • Keyboard friendly - Full arrow key navigation and shortcuts support
  • Smart positioning - Automatically adjust to stay within viewport bounds
  • Accessible by design - ARIA compliant with proper focus management
  • Flexible structure - Support for groups, separators, and nested submenus
  • Visual hierarchy - Clear organization with labels and visual separation
  • Touch optimized - Appropriately sized targets for mobile interactions

Essential dropdown patterns you'll use

Simple action menu

Basic dropdown for common actions:

Loading component...

Checkbox options

Perfect for toggleable settings and view options:

Loading component...

Radio button selections

Single-choice options like themes or layouts:

Loading component...

Icon-enhanced menu

Visual cues make options easier to scan:

Loading component...

Nested submenus

Organize complex hierarchies without overwhelming users:

Loading component...

API Reference

The root component that manages dropdown state and positioning.

PropTypeDefaultDescription
openboolean-Whether the dropdown is open
onOpenChange(open: boolean) => void-Callback when open state changes
defaultOpenbooleanfalseDefault open state (uncontrolled)
dir"ltr" | "rtl""ltr"Text direction for proper positioning
modalbooleantrueWhether to render as modal
childrenReact.ReactNode-Dropdown trigger and content

Element that opens the dropdown when activated.

PropTypeDefaultDescription
asChildbooleanfalseRender as child element instead of button
childrenReact.ReactNode-Trigger content

The popup content container that holds menu items.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
align"start" | "center" | "end""center"Alignment relative to trigger
side"top" | "right" | "bottom" | "left""bottom"Preferred side to open
sideOffsetnumber4Distance from trigger element
alignOffsetnumber0Offset from align position
childrenReact.ReactNode-Menu items and groups

Individual selectable item within the menu.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
disabledbooleanfalseWhether item is disabled
onSelect(event: Event) => void-Callback when item is selected
textValuestring-Optional value for typeahead search
childrenReact.ReactNode-Item content

Menu item with checkbox for toggleable options.

PropTypeDefaultDescription
checkedboolean | "indeterminate"-Checkbox state
onCheckedChange(checked: boolean) => void-Callback when checkbox changes
disabledbooleanfalseWhether item is disabled
childrenReact.ReactNode-Item content

Menu item for single-choice selections within a radio group.

PropTypeDefaultDescription
valuestring-Unique value for this radio option
disabledbooleanfalseWhether item is disabled
childrenReact.ReactNode-Item content

Non-interactive label for organizing menu sections.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Label text

Visual separator between menu sections.

PropTypeDefaultDescription
classNamestring-Additional CSS classes

Display keyboard shortcuts for menu items.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Shortcut text (e.g., "⌘K")

Container for nested submenu functionality.

PropTypeDefaultDescription
openboolean-Whether submenu is open
onOpenChange(open: boolean) => void-Callback when submenu state changes
childrenReact.ReactNode-SubTrigger and SubContent

Positioning Options

SideDescriptionBest Use Cases
bottomOpens below triggerDefault for most buttons and actions
topOpens above triggerWhen bottom space is limited
leftOpens to the leftRight-aligned triggers, RTL layouts
rightOpens to the rightLeft-aligned triggers, additional space

Keyboard Navigation

KeyAction
Space/EnterOpen dropdown or select item
Arrow DownMove to next item
Arrow UpMove to previous item
Arrow RightOpen submenu or move to parent level
Arrow LeftClose submenu or move to parent level
HomeMove to first item
EndMove to last item
EscapeClose dropdown
TabClose dropdown and move to next element
A-ZTypeahead search to matching item

Component Hierarchy

Dropdown menus support rich nesting and organization:

  • DropdownMenuGroup - Logical grouping of related items
  • DropdownMenuRadioGroup - Container for radio button selections
  • DropdownMenuSub - Nested submenu with trigger and content
  • DropdownMenuPortal - Render submenu in different DOM location

Best practices for dropdown menus

Create intuitive and efficient menu experiences:

  • Clear labels - Use action-oriented text that describes what will happen
  • Logical grouping - Organize related items together with separators
  • Appropriate icons - Enhance recognition without cluttering the interface
  • Smart shortcuts - Include keyboard shortcuts for power users
  • Reasonable length - Keep menus scannable, use submenus for long lists
  • Disabled states - Show unavailable options with clear disabled styling
  • Responsive design - Ensure touch targets are large enough on mobile
  • Loading states - Handle async actions with proper loading indicators
  • Destructive actions - Use clear styling and confirmation for dangerous operations