Overview
The DropdownMenu component is built on top of Radix UI’s DropdownMenu primitive and provides a comprehensive set of components for creating accessible dropdown menus with various item types, separators, and sub-menus.Components
DropdownMenu
The root component that manages the open/close state of the dropdown menu. Inherits all props from@radix-ui/react-dropdown-menu Root component.
DropdownMenuTrigger
The button or element that triggers the dropdown menu.When true, merges props with the child element instead of rendering a button.
@radix-ui/react-dropdown-menu Trigger component.
DropdownMenuContent
The container for dropdown menu items.Additional CSS classes to apply to the content container.
The distance in pixels from the trigger.
Ref forwarded to the underlying content element.
@radix-ui/react-dropdown-menu Content component.
DropdownMenuItem
A clickable item within the dropdown menu.Additional CSS classes to apply to the item.
When true, adds left padding to align with labeled items.
Ref forwarded to the underlying item element.
@radix-ui/react-dropdown-menu Item component.
DropdownMenuCheckboxItem
A menu item with a checkbox indicator.Additional CSS classes to apply to the checkbox item.
The checked state of the checkbox.
Ref forwarded to the underlying checkbox item element.
@radix-ui/react-dropdown-menu CheckboxItem component.
DropdownMenuRadioItem
A menu item with a radio button indicator. Must be used within a DropdownMenuRadioGroup.Additional CSS classes to apply to the radio item.
Ref forwarded to the underlying radio item element.
@radix-ui/react-dropdown-menu RadioItem component.
DropdownMenuLabel
A label for a group of menu items.Additional CSS classes to apply to the label.
When true, adds left padding to align with other items.
Ref forwarded to the underlying label element.
@radix-ui/react-dropdown-menu Label component.
DropdownMenuSeparator
A visual separator between menu items.Additional CSS classes to apply to the separator.
Controls the vertical spacing around the separator.
md: 1rem (16px) marginlg: 2rem (32px) margin
Ref forwarded to the underlying separator element.
@radix-ui/react-dropdown-menu Separator component.
DropdownMenuShortcut
Displays a keyboard shortcut hint aligned to the right of a menu item.Additional CSS classes to apply to the shortcut text.
React.HTMLAttributes<HTMLSpanElement>.
DropdownMenuGroup
Groups related menu items together. Inherits all props from@radix-ui/react-dropdown-menu Group component.
DropdownMenuSub
The root component for a submenu. Inherits all props from@radix-ui/react-dropdown-menu Sub component.
DropdownMenuSubTrigger
The trigger for opening a submenu.Additional CSS classes to apply to the sub-trigger.
When true, adds left padding to align with other items.
Ref forwarded to the underlying sub-trigger element.
@radix-ui/react-dropdown-menu SubTrigger component.
DropdownMenuSubContent
The container for submenu items.Additional CSS classes to apply to the sub-content.
Ref forwarded to the underlying sub-content element.
@radix-ui/react-dropdown-menu SubContent component.
DropdownMenuPortal
Portals the dropdown menu content to a different part of the DOM. Inherits all props from@radix-ui/react-dropdown-menu Portal component.
DropdownMenuRadioGroup
Groups radio items together to ensure only one can be selected at a time. Inherits all props from@radix-ui/react-dropdown-menu RadioGroup component.
Usage
Basic Menu
With Keyboard Shortcuts
With Submenu
Accessibility
The DropdownMenu component is built on Radix UI primitives and includes comprehensive accessibility features:- Full keyboard navigation support
- Focus management
- Screen reader announcements
- ARIA attributes for proper semantics
- Support for disabled items
Source
Implementation:/home/daytona/workspace/source/packages/ui/src/dropdown-menu/dropdown-menu.tsx
Styles: /home/daytona/workspace/source/packages/ui/src/dropdown-menu/dropdown-menu.styles.tsx