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
  • MenuList - List of menu items
  • MenuItem - Individual menu item (action, link, or checkbox)
  • MenuGroup - Groups menu items under a heading
  • MenuToggle - Toggle button that opens/closes a menu
  • Dropdown - Pre-configured menu for dropdown use cases
  • SingleSelect - Pre-configured menu for single selection
  • MultiSelect - Pre-configured menu for multiple selection
  • MenuSearch - Search/filter input within a menu
  • MenuFooter - Footer area for additional actions

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.
     
     
     
     
     
     
     
     
     
    The menu toggle component pairs with the menu OR the panel component to create a more customizable dropdown and select implementations.
     
     
     
    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.
     
    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.