DropdownMenu
Open a compact action menu from a visible trigger.
Use DropdownMenu for a compact set of actions opened from a visible trigger. Use Select for choosing a form value.
Basic usage#
Playground#
Anatomy#
Content is portaled; grouped items use the same item subtree as ungrouped items.
Usage#
Trigger and items#
Use DropdownMenu.Trigger to compose the click, keyboard, and ARIA behavior with your native attributes. Describe each action in the item model; groups and separators organize that model without adding application state.
Stateful and nested items#
Checkbox and radio-like menu items receive their checked or selected state from your application through their callbacks. Nested children create submenus. Disabled items remain visible but cannot be activated.
Keyboard interaction#
| Key | Description |
|---|---|
| ↵ / Space / ↓ | Opens the menu from an eligible trigger interaction. |
| ↓ / ↑ | Moves the active item through available menu entries. |
| → | Opens an available submenu from its parent item. |
| ← | Returns from a submenu to its parent menu. |
| ↵ / Space | Activates the current menu item. |
| Esc | Closes the current menu layer. |
Examples#
Workspace view settings#
Toggle visible fields, include archived projects, and choose a sort order. The preview updates from application-owned state; saving a shared view is disabled for viewers.
Checkbox and radio items#
Submenus#
Shortcuts and disabled items#
Attributes#
data-closedSlot: dropdown-menu-trigger, dropdown-menu-contentDescription: Present when disclosure or transition content is closed.data-disabledSlot: dropdown-menu-trigger, dropdown-menu-itemDescription: Present when the component, slot, or item is disabled.data-expandedSlot: dropdown-menu-trigger, dropdown-menu-content, dropdown-menu-itemDescription: Present when the panel, accordion, or menu is expanded.data-alignSlot: dropdown-menu-contentDescription: Stores the resolved alignment of positioned content.data-sideSlot: dropdown-menu-contentDescription: Stores the resolved floating or drawer content side.data-destructiveSlot: dropdown-menu-itemDescription: Present when the action has destructive semantics.data-highlightedSlot: dropdown-menu-itemDescription: Present when the item is highlighted by pointer or keyboard navigation.data-selectedSlot: dropdown-menu-itemDescription: Present when the item or tab is selected.Props#
DropdownMenu#
Trigger#
Renders a <button> element by default.
Content#
Props for the DropdownMenu component. Renders a <div> element by default.