A set of actions in a popover.
The components can be imported via:
A DropdownMenu is composed of several components:
DropdownMenu - the root component, which sets up the context, state and interactionsDropdownMenuTrigger - the element that triggers the dropdown menu to showDropdownMenuTriggerButton - a Button component that acts as a trigger for the dropdown menuDropdownMenuContent - the container for menu itemsDropdownMenuGroup - optional component to organize items into labeled groupsDropdownMenuItem - individual selectable items in the menuDropdownMenuCheckboxItem - selectable items with a checkbox stateDropdownMenuFooter - component to display footer content at the bottom of a dropdown menuDropdownMenuSub - wrapper component for nested submenusDropdownMenuSubTrigger - trigger component for nested submenusYou can organize related menu items using the DropdownMenuGroup component:
Menu items can include icons for better visual recognition:
Menu items can include descriptions to provide additional context or explanation:
Menu items can show tooltips when hovering over them, providing additional information or context. The most common use case is to show a tooltip when the item is disabled.
Checkbox items allow users to toggle state within a dropdown menu:
Menu items can be disabled to indicate they're not available:
By default, clicking a menu item will close the dropdown. You can prevent this behavior by setting shouldCloseOnClick={false}. This is useful when the user might want to select multiple items or perform actions without closing the menu.
The isDanger prop can be used to style menu items with a red color, indicating destructive or risky actions:
Menu items can be rendered as links by providing the href attribute. This is useful for navigation or opening resources:
The DropdownMenuTriggerButton component is a convenient way to use a Button as the trigger for your dropdown menu. It supports all Button props (variant, size, icon, etc.).
By default, DropdownMenuTrigger will render an unstyled button tag. It is important
to render an element that is focusable, and that indicates it can be clicked.
The DropdownMenu component exposes Floating UI props, which can
be used to attach trigger interactions to any element.
The dropdown menu can be positioned relative to the trigger using the placement prop:
You can add a footer to the dropdown menu using the DropdownMenuFooter component. The footer must be placed directly inside the DropdownMenuContent component:
Dropdown menus can contain nested submenus for organizing hierarchical actions or options.
Nested menus use the DropdownMenuSub component to wrap the nested content,
and the DropdownMenuSubTrigger component which is the trigger for the submenu,
as well as a menu item in its parent menu.
The DropdownMenu component follows the ARIA menu button pattern and includes the following accessibility features:
The component supports focus trap functionality via the shouldTrapFocus prop, which keeps focus within the menu when it's open:
More focus management options are available via the following props:
isFocusManagerDisabledshouldTrapFocusinitialFocusshouldReturnFocusshouldRenderFocusGuardsshouldShowVisuallyHiddenDismissfocusOrderPlumaDropdownMenu extends BoxAdditional middleware to apply to Floating UI, for example custom middleware for more control. These will be applied after the default middleware.
Default:125
The duration (in ms) for the popover animation.
Whether the popover should be open initially
Default:['content']
The order in which focus should be moved when navigating through the popover. See Floating UI for more details.
Default:0
Which element to initially focus when the popover is opened.
Can be a number (a tabbable index as specified by focusOrder) or an HTMLElement.
See Floating UI for more details.
Default:false
Whether the popover should be disabled. Can be used to conditionally enable/disable a popover depending on state.
Default:false
Whether the popover should be draggable.
Default:false
Whether the focus manager (for the opened popover) should be disabled entirely. See Floating UI for more details.
Whether the popover should be open. Only use this along with onOpenChange if you want to control the state of the popover
Called when the open state of the popover is changing
Where the popover should be placed in relation to the trigger
Default:true
Whether focusout event listeners are attached to the trigger and popover,
to close the popover when focus moves outside of it.
See Floating UI for more details.
Default:true
Whether the focus guards are rendered by the focus manager. See Floating UI for more details.
Default:true
Whether the popover content's max width and/or max height should be restricted using the Floating UI size middleware.
By default, this is disabled so that the dropdown menu is not restricted
Default:true
Whether focus should be returned to the trigger when the popover is closed. See Floating UI for more details.
Default:false
Whether visually hidden close buttons are rendered before and after the popover. See Floating UI for more details.
Default:false
If the popover contains interactive elements, the dialog pattern should be applied.
Enable shouldTrapFocus to ensure focus is kept within the popover while it's open.
See Floating UI for more details.
Default:true
Whether the popover should open when the trigger is clicked. This is the recommended default.
Default:false
Whether the popover should open when the trigger is focused.
Defaults to true when shouldTriggerOnHover is true.
Default:false
Whether the popover should open when the trigger is hovered. Only use if absolutely necessary, as Popovers are meant to be triggered by clicks.
The position CSS property to use on the floating element
Additional classes to apply on the popover component (the floating element, not the trigger). Should only be used as a last resort
Additional classes to apply on the popover content component. Should only be used as a last resort
Additional inline styles to apply on the popover component (the floating element, not the trigger). Should only be used as a last resort
An internal function to pass the Floating UI nodeId up to a parent if necessary.
Default:false
Whether "typeahead" functionality should be enabled, which focuses items while typing.
See Floating UI for more details.
Enabled by default when shouldNavigateList is true.
PlumaDropdownMenuTrigger extends BoxPlumaDropdownMenuContent extends BoxPlumaDropdownMenuGroup extends BoxAn option label for the group. If not provided, the group won't render a header, but will still render a divider to separate action items from other groups.
PlumaDropdownMenuItem extends BoxOptional description text to display below the menu item
The URL for the link, if the item should render as a link instead of a button
Optional icon to display alongside the menu item text
Whether the item should be displayed with critical/danger styling
Whether the item is disabled
Whether the link is external. When this flag is true, an a tag will be used,
and target="_blank" rel="noopener noreferrer" will be added automatically
Whether this item is also a trigger for another sub-menu.
Function called when the item is selected
This is passed into the provider's linkComponent when used with href.
It can be used by the link component implementation to handle replaceState instead of pushState
Default:true
Whether clicking the item should close the popover
Optional tooltip text to display when hovering over the menu item
Optional icon to display on the trailing side of the menu item. Typically used for a sub-menu trigger indicator (e.g. a right chevron).
Default:true
Whether to add safe external attributes (target="_blank" rel="noopener noreferrer")
for external links. This can be turned off for special cases like mailto: links
PlumaDropdownMenuTriggerButton extends ButtonPlumaDropdownMenuCheckboxItem extends BoxOptional description text to display below the menu item
The URL for the link, if the item should render as a link instead of a button
Whether the checkbox is checked
Whether the item should be displayed with critical/danger styling
Whether the item is disabled
Whether the link is external. When this flag is true, an a tag will be used,
and target="_blank" rel="noopener noreferrer" will be added automatically
Whether this item is also a trigger for another sub-menu.
Callback to be called when the checkbox is checked or unchecked
Function called when the item is selected
This is passed into the provider's linkComponent when used with href.
It can be used by the link component implementation to handle replaceState instead of pushState
Default:true
Whether clicking the item should close the popover
Optional tooltip text to display when hovering over the menu item
Optional icon to display on the trailing side of the menu item. Typically used for a sub-menu trigger indicator (e.g. a right chevron).
Default:true
Whether to add safe external attributes (target="_blank" rel="noopener noreferrer")
for external links. This can be turned off for special cases like mailto: links
PlumaDropdownMenuSubTrigger extends BoxThe URL for the link, if the item should render as a link instead of a button
Whether the trigger is disabled
Whether the link is external. When this flag is true, an a tag will be used,
and target="_blank" rel="noopener noreferrer" will be added automatically
Function called when the item is selected
This is passed into the provider's linkComponent when used with href.
It can be used by the link component implementation to handle replaceState instead of pushState
Default:true
Whether clicking the item should close the popover
Default:true
Whether to add safe external attributes (target="_blank" rel="noopener noreferrer")
for external links. This can be turned off for special cases like mailto: links
PlumaDropdownMenuSub extends Box