Class MultiSelectTypeahead
java.lang.Object
org.patternfly.component.ComponentDelegate<HTMLElement, MultiSelectTypeahead>
org.patternfly.component.menu.MultiSelectTypeahead
- All Implemented Interfaces:
Attachable, ElementAttributeMethods<HTMLElement, MultiSelectTypeahead>, ElementClassListMethods<HTMLElement, MultiSelectTypeahead>, ElementConsumerMethods<HTMLElement, MultiSelectTypeahead>, ElementContainerMethods<HTMLElement, MultiSelectTypeahead>, ElementEventMethods<HTMLElement, MultiSelectTypeahead>, ElementIdMethods<HTMLElement, MultiSelectTypeahead>, ElementQueryMethods<HTMLElement>, HTMLElementAttributeMethods<HTMLElement, MultiSelectTypeahead>, HTMLElementDataMethods<HTMLElement, MultiSelectTypeahead>, HTMLElementStyleMethods<HTMLElement, MultiSelectTypeahead>, HTMLElementVisibilityMethods<HTMLElement, MultiSelectTypeahead>, IsElement<HTMLElement>, TypedBuilder<HTMLElement, MultiSelectTypeahead>, Component, Expandable<HTMLElement, MultiSelectTypeahead>, Typeahead<MultiSelectTypeahead>, OuiaSupport<HTMLElement, MultiSelectTypeahead>, Modifiers.Disabled<HTMLElement, MultiSelectTypeahead>
public class MultiSelectTypeahead
extends ComponentDelegate<HTMLElement, MultiSelectTypeahead>
implements Typeahead<MultiSelectTypeahead>
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. As a user enters characters into the text input, the menu options will be filtered to match.
This implementation uses the Popover API and CSS anchor positioning instead of Popper.js. The typeahead 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 Summary
Modifier and TypeMethodDescriptionallowNewItems(Function<String, Promise<MenuItem>> createItem) applyToMenuList(Consumer<MenuList> consumer) applyToMenuToggle(Consumer<MenuToggle> consumer) Provides access to the underlying menu toggle using a fluent API stylevoidattach(MutationRecord mutationRecord) voidclear()voidclear(boolean fireEvent) voidcollapse(boolean fireEvent) voiddetach(MutationRecord mutationRecord) disabled(boolean disabled) Adds/removes modifier(disabled)voidexpand(boolean fireEvent) filter(SearchFilter searchFilter) Sets the filter used to match existing menu items against the current input value.booleanmenu()static MultiSelectTypeaheadmultiSelectTypeahead(String id, String placeholder) Creates a newMultiSelectTypeaheadcomponent with aMenuToggleof typeMenuToggleType.typeaheadand aFilterInputGroup.static MultiSelectTypeaheadmultiSelectTypeahead(BaseFilterInputGroup<?> filterInput) Creates a newMultiSelectTypeaheadcomponent with aMenuToggleof typeMenuToggleType.typeaheadand the specifiedBaseFilterInputGroup.onLoaded(ComponentHandler<MultiSelectTypeahead> loadedHandler) onNoResults(NoResults noResults) Configures the behavior for generating a "no results" menu item when no matching items are found.onToggle(ToggleHandler<MultiSelectTypeahead> toggleHandler) refreshOn(RefreshStrategy strategy) Sets the refresh strategy for asynchronously loaded items.voidselectIdentifiers(List<String> identifiers) voidselectIdentifiers(List<String> identifiers, boolean fireEvent) voidselectItems(List<MenuItem> items) voidselectItems(List<MenuItem> items, boolean fireEvent) stayOpen(StayOpenPredicate<MenuToggle> stayOpen) Specifies a condition that determines whether the menu should remain open when the menu-toggle or the menu is clicked.that()Methods inherited from class ComponentDelegate
componentType, element, ouiaComponentTypeMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ElementAttributeMethods
aria, aria, aria, attr, attr, attr, role, roleMethods inherited from interface ElementClassListMethods
classList, classList, css, toggle, toggle, toggleMethods inherited from interface ElementConsumerMethods
apply, runMethods inherited from interface ElementContainerMethods
add, add, add, add, addAll, addAll, addAll, addAll, addAll, addAllMethods inherited from interface ElementEventMethods
on, on, onMethods inherited from interface ElementIdMethods
id, uniqueIdMethods inherited from interface ElementQueryMethods
closest, querySelector, querySelectorAllMethods inherited from interface HTMLElementAttributeMethods
titleMethods inherited from interface HTMLElementDataMethods
data, dataMethods inherited from interface HTMLElementVisibilityMethods
hiddenMethods inherited from interface Modifiers.Disabled
disabledMethods inherited from interface OuiaSupport
initOuia, initOuia, ouiaId, ouiaSafe, ouiaTransition
-
Method Details
-
multiSelectTypeahead
Creates a newMultiSelectTypeaheadcomponent with aMenuToggleof typeMenuToggleType.typeaheadand aFilterInputGroup. -
multiSelectTypeahead
Creates a newMultiSelectTypeaheadcomponent with aMenuToggleof typeMenuToggleType.typeaheadand the specifiedBaseFilterInputGroup.- Parameters:
filterInput- theBaseFilterInputGroupinstance used to configure the typeahead component- Returns:
- a new
MultiSelectTypeaheadinstance configured with the given filter input
-
allowNewItems
-
allowNewItems
-
that
- Specified by:
thatin interfaceTypedBuilder<HTMLElement, MultiSelectTypeahead>
-
refreshOn
Description copied from interface:TypeaheadSets the refresh strategy for asynchronously loaded items.- Specified by:
refreshOnin interfaceTypeahead<MultiSelectTypeahead>
-
applyToMenuList
Applies the providedConsumerto theMenuListassociated with thisMultiSelect. 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, andMenuListin 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 useMenuGroups.- Parameters:
consumer- aConsumerthat accepts aMenuListfor customization or modification- Returns:
- the current
MultiSelectinstance for method chaining
-
clear
public void clear() -
clear
public void clear(boolean fireEvent) -
selectIdentifiers
-
selectIdentifiers
-
selectItems
-
selectItems
-
attach
- Specified by:
attachin interfaceAttachable
-
detach
- Specified by:
detachin interfaceAttachable
-
applyToMenuToggle
Provides access to the underlying menu toggle using a fluent API style -
disabled
Description copied from interface:Modifiers.DisabledAdds/removes modifier(disabled)- Specified by:
disabledin interfaceModifiers.Disabled<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
-
isDisabled
public boolean isDisabled()- Specified by:
isDisabledin interfaceModifiers.Disabled<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
-
placement
-
stayOpen
Specifies a condition that determines whether the menu should remain open when the menu-toggle or the menu is clicked.- Parameters:
stayOpen- aStayOpenPredicatethat evaluates anEventto determine if the menu remains open.- Returns:
- the current instance with the condition applied, enabling method chaining.
-
ariaLabel
-
onLoaded
-
onToggle
-
collapse
public void collapse(boolean fireEvent) - Specified by:
collapsein interfaceExpandable<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
-
expand
public void expand(boolean fireEvent) - Specified by:
expandin interfaceExpandable<HTMLElement, B extends TypedBuilder<HTMLElement, B>>
-