Class Dropdown

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

public class Dropdown extends ComponentDelegate<HTMLElement, Dropdown>
A dropdown presents a menu of actions or links in a constrained space that will trigger a process or navigate to a new location.

This implementation uses the Popover API and CSS anchor positioning instead of Popper.js. The dropdown 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

    • applyToMenuList

      public Dropdown applyToMenuList(Consumer<MenuList> consumer)
      Applies the provided Consumer to the MenuList associated with this Dropdown. 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 DropdownMenu, 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 Dropdown instance for method chaining
    • that

      public Dropdown that()
    • 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 Dropdown addMenu(Menu menu)
    • add

      public Dropdown add(Menu menu)
    • applyToMenuToggle

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

      public Dropdown 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 Dropdown placement(org.patternfly.style.Placement placement)
    • stayOpen

      public Dropdown 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 Dropdown ariaLabel(String label)
    • onLoaded

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

      public Dropdown onToggle(org.patternfly.handler.ToggleHandler<Dropdown> 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>>