Package org.patternfly.component.menu
package org.patternfly.component.menu
Provides menu components for building dropdowns, selects, and general-purpose menus.
This package contains the Menu component and related classes for creating
menus, dropdowns, single selects, multi selects, and typeaheads. Menus support different types (action, select,
checkbox), selection modes (click, single, multi), grouped items, icons, descriptions, danger items, search
filtering, and item actions.
Components
Menu- Core menu component with configurable type and selection modeMenuContent- Scrollable content area of a menuMenuFooter- Footer area for additional actionsMenuGroup- Groups menu items under a headingMenuHeader- Header area of a menuMenuItem- Individual menu item (action, link, or checkbox)MenuItemAction- Action button within a menu itemMenuList- List of menu itemsMenuSearch- Search/filter input within a menuMenuToggle- Toggle button that opens/closes a menuMenuToggleAction- Action button within a split-button menu toggleDropdown- Pre-configured menu for dropdown use casesDropdownMenu- Menu variant used within dropdown componentsSingleSelect- Pre-configured menu for single selectionMultiSelect- Pre-configured menu for multiple selectionSingleTypeahead- Single-select typeahead with search inputMultiTypeahead- Multi-select typeahead with filter inputMenuType- Enumeration of menu types (menu, select, checkbox)MenuToggleType- Enumeration of menu toggle variants (default, plain, split button)MenuActionHandler- Handler interface for menu item action events
Usage
A basic action menu and a dropdown:
import static org.patternfly.component.SelectionMode.click;
import static org.patternfly.component.menu.Dropdown.dropdown;
import static org.patternfly.component.menu.Menu.menu;
import static org.patternfly.component.menu.MenuContent.menuContent;
import static org.patternfly.component.menu.MenuItem.menuItem;
import static org.patternfly.component.menu.MenuList.menuList;
import static org.patternfly.component.menu.MenuToggle.menuToggle;
import static org.patternfly.component.menu.MenuType.menu;
// Basic action menu
Menu actionMenu = menu(menu, click)
.addContent(menuContent()
.addList(menuList()
.addItem(menuItem("item-0", "Action"))
.addItem(menuItem("item-1", "Another action"))
.addItem(menuItem("item-2", "Disabled action")
.disabled())));
// Dropdown with toggle
Dropdown dropdown = dropdown(menuToggle("Dropdown"))
.addMenu(menu()
.addContent(menuContent()
.addList(menuList()
.addItem(menuItem("option-0", "Option 1"))
.addItem(menuItem("option-1", "Option 2"))
.addItem(menuItem("option-2", "Option 3")))));
- See Also:
-
ClassDescriptionA dropdown presents a menu of actions or links in a constrained space that will trigger a process or navigate to a new location.Menu used for
Dropdowncomponents.A menu is a list of options or actions that users can choose from.Handler invoked when aMenuItemActionis triggered on aMenuItem.The scrollable content area of aMenucomponent.The footer area of aMenucomponent.A group of related items within aMenucomponent.The header area of aMenucomponent.An individual selectable item within aMenucomponent.An action element associated with aMenuItem.A search input area within aMenucomponent.The menu toggle component pairs with the menu OR the panel component to create a more customizable dropdown and select implementations.An action element within aMenuTogglecomponent.Defines the visual variants available for aMenuToggle.A select component to select multiple items from a list.Menu used forMultiSelectandMultiTypeaheadcomponents.A typeahead is a select variant that replaces the typical button toggle for opening the select menu with a text input and button toggle combo.Functional interface that is responsible for generating a menu item when no results are found in a given menu list for a specific input text.Deprecated.This implementation uses the Popper.js API, which is due to be removed soon.Deprecated.This implementation uses the Popper.js API, which is due to be removed soon.Deprecated.This implementation uses the Popper.js API, which is due to be removed soon.Deprecated.This implementation uses the Popper.js API, which is due to be removed soon.Deprecated.This implementation uses the Popper.js API, which is due to be removed soon.PopperTypeahead<M extends org.patternfly.component.menu.PopperMenuToggleMenu<M>>Deprecated.Represents a search filter for menu items.A select component to select exactly one item from a list.Menu used forSingleSelectandSingleTypeaheadcomponents.A typeahead is a select variant that replaces the typical button toggle for opening the select menu with a text input and button toggle combo.Predicate that determines whether a menu should stay open after an interaction.Typeahead<M extends org.patternfly.component.menu.MenuToggleMenu<M>>Represents a typeahead component interface that allows users to search, filter, and optionally create new items dynamically based on input.