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:
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:
Checkbox options
Perfect for toggleable settings and view options:
Radio button selections
Single-choice options like themes or layouts:
Icon-enhanced menu
Visual cues make options easier to scan:
Nested submenus
Organize complex hierarchies without overwhelming users:
API Reference
DropdownMenu
The root component that manages dropdown state and positioning.
Prop | Type | Default | Description |
---|---|---|---|
open | boolean | - | Whether the dropdown is open |
onOpenChange | (open: boolean) => void | - | Callback when open state changes |
defaultOpen | boolean | false | Default open state (uncontrolled) |
dir | "ltr" | "rtl" | "ltr" | Text direction for proper positioning |
modal | boolean | true | Whether to render as modal |
children | React.ReactNode | - | Dropdown trigger and content |
DropdownMenuTrigger
Element that opens the dropdown when activated.
Prop | Type | Default | Description |
---|---|---|---|
asChild | boolean | false | Render as child element instead of button |
children | React.ReactNode | - | Trigger content |
DropdownMenuContent
The popup content container that holds menu items.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
align | "start" | "center" | "end" | "center" | Alignment relative to trigger |
side | "top" | "right" | "bottom" | "left" | "bottom" | Preferred side to open |
sideOffset | number | 4 | Distance from trigger element |
alignOffset | number | 0 | Offset from align position |
children | React.ReactNode | - | Menu items and groups |
DropdownMenuItem
Individual selectable item within the menu.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
disabled | boolean | false | Whether item is disabled |
onSelect | (event: Event) => void | - | Callback when item is selected |
textValue | string | - | Optional value for typeahead search |
children | React.ReactNode | - | Item content |
DropdownMenuCheckboxItem
Menu item with checkbox for toggleable options.
Prop | Type | Default | Description |
---|---|---|---|
checked | boolean | "indeterminate" | - | Checkbox state |
onCheckedChange | (checked: boolean) => void | - | Callback when checkbox changes |
disabled | boolean | false | Whether item is disabled |
children | React.ReactNode | - | Item content |
DropdownMenuRadioItem
Menu item for single-choice selections within a radio group.
Prop | Type | Default | Description |
---|---|---|---|
value | string | - | Unique value for this radio option |
disabled | boolean | false | Whether item is disabled |
children | React.ReactNode | - | Item content |
DropdownMenuLabel
Non-interactive label for organizing menu sections.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
children | React.ReactNode | - | Label text |
DropdownMenuSeparator
Visual separator between menu sections.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
DropdownMenuShortcut
Display keyboard shortcuts for menu items.
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
children | React.ReactNode | - | Shortcut text (e.g., "⌘K") |
DropdownMenuSub
Container for nested submenu functionality.
Prop | Type | Default | Description |
---|---|---|---|
open | boolean | - | Whether submenu is open |
onOpenChange | (open: boolean) => void | - | Callback when submenu state changes |
children | React.ReactNode | - | SubTrigger and SubContent |
Positioning Options
Side | Description | Best Use Cases |
---|---|---|
bottom | Opens below trigger | Default for most buttons and actions |
top | Opens above trigger | When bottom space is limited |
left | Opens to the left | Right-aligned triggers, RTL layouts |
right | Opens to the right | Left-aligned triggers, additional space |
Keyboard Navigation
Key | Action |
---|---|
Space /Enter | Open dropdown or select item |
Arrow Down | Move to next item |
Arrow Up | Move to previous item |
Arrow Right | Open submenu or move to parent level |
Arrow Left | Close submenu or move to parent level |
Home | Move to first item |
End | Move to last item |
Escape | Close dropdown |
Tab | Close dropdown and move to next element |
A-Z | Typeahead 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
Drawer
A versatile drawer component for slide-out panels and mobile-first interfaces. Perfect for navigation menus, forms, and contextual actions.
Form
Build accessible, type-safe forms with React Hook Form and Zod validation. Composable components that handle state, validation, and accessibility automatically.