Class Menu
- All Implemented Interfaces:
Attachable, ElementAttributeMethods<HTMLDivElement, Menu>, ElementClassListMethods<HTMLDivElement, Menu>, ElementConsumerMethods<HTMLDivElement, Menu>, ElementContainerMethods<HTMLDivElement, Menu>, ElementEventMethods<HTMLDivElement, Menu>, ElementIdMethods<HTMLDivElement, Menu>, ElementQueryMethods<HTMLDivElement>, HTMLElementAttributeMethods<HTMLDivElement, Menu>, HTMLElementDataMethods<HTMLDivElement, Menu>, HTMLElementStyleMethods<HTMLDivElement, Menu>, HTMLElementVisibilityMethods<HTMLDivElement, Menu>, IsElement<HTMLDivElement>, TypedBuilder<HTMLDivElement, Menu>, Component, Modifiers.Plain<HTMLDivElement, Menu>
- Direct Known Subclasses:
DropdownMenu, MultiSelectMenu, SingleSelectMenu
public class Menu
extends BaseComponent<HTMLDivElement, Menu>
implements Attachable, Modifiers.Plain<HTMLDivElement, Menu>
A menu is a list of options or actions that users can choose from. It can be used in a variety of contexts whenever the user
needs to choose between multiple values, options, or actions. A menu is most often paired with a
MenuToggle as its
trigger, but can also be used inline or can be attached to other interactable elements to toggle it open and close.
Menu menu = menu(MenuType.menu, click)
.scrollable()
.height("200px")
.addHeader("Header")
.addContent(menuContent()
.addList(menuList()
.addItem(MenuItem.menuItem("1", "Item 1"))
.addItem(MenuItem.menuItem("2", "Item 2"))
.addDivider()
.addItem(MenuItem.linkMenuItem("3", "Item 3", "#third"))))
.addFooter(menuFooter()
.add(button("Footer")));
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionadd(MenuContent content) addContent(MenuContent content) Shortcut foraddFooter(menuFooter(text))addFooter(MenuFooter footer) Shortcut foraddHeader(menuHeader(text))addHeader(MenuHeader header) addSearch(MenuSearch search) voidSets the `tabIndex` property of the first focusable item within a menu to `0`, allowing it to be reachable via the Tab key.voidattach(MutationRecord mutationRecord) voiddetach(MutationRecord mutationRecord) flyout()booleanChecks if the menu contains any asynchronous items that are currently in a pending status.Sets the--pf-v5-c-menu__content--MaxHeightvariable to the specified valueitems()static Menumenu(MenuType menuType, SelectionMode selectionMode) onAction(MenuActionHandler actionHandler) onMultiSelect(MultiSelectHandler<Menu, MenuItem> selectHandler) onSingleSelect(SelectHandler<MenuItem> selectHandler) voidreload()voidvoidvoidvoidvoidvoidthat()Methods inherited from class BaseComponent
componentType, element, registerComponentMethods 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.Plain
plain, plain
-
Method Details
-
attach
- Specified by:
attachin interfaceAttachable
-
detach
- Specified by:
detachin interfaceAttachable
-
addHeader
-
addDivider
-
favorites
-
flyout
-
height
-
scrollable
-
that
- Specified by:
thatin interfaceTypedBuilder<HTMLDivElement, Menu>
-
onSingleSelect
-
onMultiSelect
-
allowTabFirstItem
public void allowTabFirstItem()Sets the `tabIndex` property of the first focusable item within a menu to `0`, allowing it to be reachable via the Tab key. Focusable items are identified as non-disabled ` -
findItem
-
hasAsyncItems
-
items
-
reload
public void reload() -
select
-
select
-
select
-
selectedItems