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 mode
  • MenuContent - Scrollable content area of a menu
  • MenuFooter - Footer area for additional actions
  • MenuGroup - Groups menu items under a heading
  • MenuHeader - Header area of a menu
  • MenuItem - Individual menu item (action, link, or checkbox)
  • MenuItemAction - Action button within a menu item
  • MenuList - List of menu items
  • MenuSearch - Search/filter input within a menu
  • MenuToggle - Toggle button that opens/closes a menu
  • MenuToggleAction - Action button within a split-button menu toggle
  • Dropdown - Pre-configured menu for dropdown use cases
  • DropdownMenu - Menu variant used within dropdown components
  • SingleSelect - Pre-configured menu for single selection
  • MultiSelect - Pre-configured menu for multiple selection
  • SingleTypeahead - Single-select typeahead with search input
  • MultiTypeahead - Multi-select typeahead with filter input
  • MenuType - 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:
  • Class
    Description
    A 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 Dropdown components.
    A menu is a list of options or actions that users can choose from.
    Handler invoked when a MenuItemAction is triggered on a MenuItem.
    The scrollable content area of a Menu component.
    The footer area of a Menu component.
    A group of related items within a Menu component.
    The header area of a Menu component.
    An individual selectable item within a Menu component.
    An action element associated with a MenuItem.
    A list of items within a Menu or MenuGroup.
    A search input area within a Menu component.
    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 a MenuToggle component.
    Defines the visual variants available for a MenuToggle.
     
    A select component to select multiple items from a list.
    Menu used for MultiSelect and MultiTypeahead components.
    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 for SingleSelect and SingleTypeahead components.
    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.