Dropdown

A dropdown displays a menu of actions that trigger a process and links that navigate to a new location.

Info alert:Beta feature

This beta component is currently under review and is still open for further evolution. It is available for use in product. Beta components are considered for promotion on a quarterly basis. Please join in and give us your feedback or submit any questions on the PatternFly forum or via Slack. To learn more about the process, visit our about page or our Beta components page on GitHub.

Info alert:Templates

This page showcases templates for the dropdown component. A template combines a component with logic that supports a specific use case, with a streamlined API that offers additional, limited customization.

Note: Templates live in their own package at @patternfly/react-templates!

For custom use cases, please see the dropdown component suite from @patternfly/react-core.

Examples

Simple

Props

SimpleDropdown

*required
NameTypeDefaultDescription
toggleContentrequiredReact.ReactNodeContent of the toggle.
initialItemsSimpleDropdownItem[]Initial items of the dropdown.
isDisabledbooleanFlag indicating the dropdown should be disabled.
isToggleFullWidthbooleanFlag indicated whether the dropdown toggle should take up the full width of its parent.
onSelect(event?: React.MouseEvent<Element, MouseEvent>, value?: string | number) => voidCallback triggered when any dropdown item is clicked.
onToggle(nextIsOpen: boolean) => voidCallback triggered when the dropdown toggle opens or closes.
shouldFocusToggleOnSelectbooleanFlag indicating the dropdown toggle should be focused after a dropdown item is clicked.
toggleAriaLabelstringAdds an accessible name to the dropdown toggle. Required when the dropdown toggle does not have any text content.
togglePropsMenuTogglePropsAdditional props passed to the toggle.
toggleVariant'default' | 'plain' | 'plainText'Variant style of the dropdown toggle.
toggleWidthstringWidth of the toggle.

SimpleDropdownItem

*required
NameTypeDefaultDescription
valuerequiredstring | numberUnique identifier for the dropdown item, which is used in the dropdown onSelect callback
contentReact.ReactNodeContent of the dropdown item. If the isDivider prop is true, this prop will be ignored.
isDividerbooleanFlag indicating whether the dropdown item should render as a divider. If true, the item will be rendered without the dropdown item wrapper.
onClick(event?: any) => voidCallback for when the dropdown item is clicked.
tostringURL to redirect to when the dropdown item is clicked.