Class MultiSelect

All Implemented Interfaces:
Attachable, ElementAttributeMethods<HTMLElement, MultiSelect>, ElementClassListMethods<HTMLElement, MultiSelect>, ElementConsumerMethods<HTMLElement, MultiSelect>, ElementContainerMethods<HTMLElement, MultiSelect>, ElementEventMethods<HTMLElement, MultiSelect>, ElementIdMethods<HTMLElement, MultiSelect>, ElementQueryMethods<HTMLElement>, HTMLElementAttributeMethods<HTMLElement, MultiSelect>, HTMLElementDataMethods<HTMLElement, MultiSelect>, HTMLElementStyleMethods<HTMLElement, MultiSelect>, HTMLElementVisibilityMethods<HTMLElement, MultiSelect>, IsElement<HTMLElement>, TypedBuilder<HTMLElement, MultiSelect>, Component, Expandable<HTMLElement, MultiSelect>, org.patternfly.core.OuiaSupport<HTMLElement, MultiSelect>, org.patternfly.style.Modifiers.Disabled<HTMLElement, MultiSelect>

public class MultiSelect extends ComponentDelegate<HTMLElement, MultiSelect>
A select component to select multiple items from a list.

This implementation uses the Popover API and CSS anchor positioning instead of Popper.js. The select uses the browser's top-layer rendering for correct stacking, eliminating z-index issues. CSS position-try-fallbacks handles menu flipping when there is not enough space.

See Also:
  • Method Details

    • multiSelect

      public static MultiSelect multiSelect(String text)
      Creates a new instance of MultiSelect with a toggle menu initialized using the provided text. The toggle menu includes a badge initialized with a count of zero in the read state.
      Parameters:
      text - the text to be displayed on the toggle menu
      Returns:
      a new instance of MultiSelect initialized with the specified text
    • multiSelect

      public static MultiSelect multiSelect(MenuToggle menuToggle)
      Creates a new instance of MultiSelect initialized with the specified MenuToggle.
      Parameters:
      menuToggle - the MenuToggle to initialize the MultiSelect with
      Returns:
      a new instance of MultiSelect initialized with the provided MenuToggle
    • that

      public MultiSelect that()
    • add

      public MultiSelect add(Menu menu)
    • applyToMenuList

      public MultiSelect applyToMenuList(Consumer<MenuList> consumer)
      Applies the provided Consumer to the MenuList associated with this MultiSelect. If the menu, menu content, or menu list is not yet initialized, they will be created as part of this method.

      This method simplifies the process of adding menu items to the component. It is a shortcut for creating and adding a MultiSelectMenu, MenuContent, and MenuList in a single step. Don't use this method if you need to us another menu type, want to customize the menu, content or list or if you want to use MenuGroups.

      Parameters:
      consumer - a Consumer that accepts a MenuList for customization or modification
      Returns:
      the current MultiSelect instance for method chaining
    • clear

      public void clear()
    • clear

      public void clear(boolean fireEvent)
    • selectIdentifiers

      public void selectIdentifiers(List<String> identifiers)
    • selectIdentifiers

      public void selectIdentifiers(List<String> identifiers, boolean fireEvent)
    • selectItems

      public void selectItems(List<MenuItem> items)
    • selectItems

      public void selectItems(List<MenuItem> items, boolean fireEvent)
    • attach

      public void attach(MutationRecord mutationRecord)
      Specified by:
      attach in interface Attachable
    • detach

      public void detach(MutationRecord mutationRecord)
      Specified by:
      detach in interface Attachable
    • addMenu

      public MultiSelect addMenu(Menu menu)
    • applyToMenuToggle

      public MultiSelect applyToMenuToggle(Consumer<MenuToggle> consumer)
      Provides access to the underlying menu toggle using a fluent API style
    • disabled

      public MultiSelect disabled(boolean disabled)
      Specified by:
      disabled in interface org.patternfly.style.Modifiers.Disabled<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
    • isDisabled

      public boolean isDisabled()
      Specified by:
      isDisabled in interface org.patternfly.style.Modifiers.Disabled<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
    • placement

      public MultiSelect placement(org.patternfly.style.Placement placement)
    • stayOpen

      public MultiSelect stayOpen(StayOpenPredicate stayOpen)
      Specifies a condition that determines whether the menu should remain open when the menu-toggle or the menu is clicked.
      Parameters:
      stayOpen - a Predicate that evaluates an Event to determine if the menu remains open.
      Returns:
      the current instance with the condition applied, enabling method chaining.
    • ariaLabel

      public MultiSelect ariaLabel(String label)
    • onLoaded

      public MultiSelect onLoaded(org.patternfly.handler.ComponentHandler<MultiSelect> loadedHandler)
    • onToggle

      public MultiSelect onToggle(org.patternfly.handler.ToggleHandler<MultiSelect> toggleHandler)
    • collapse

      public void collapse(boolean fireEvent)
      Specified by:
      collapse in interface Expandable<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
    • expand

      public void expand(boolean fireEvent)
      Specified by:
      expand in interface Expandable<HTMLElement, B extends TypedBuilder<HTMLElement, B>>