Package org.patternfly.component.menu
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,org.patternfly.style.Modifiers.Plain<HTMLDivElement,Menu>
- Direct Known Subclasses:
DropdownMenu,MultiSelectMenu,SingleSelectMenu,SingleTypeaheadMenu
public class Menu
extends BaseComponent<HTMLDivElement,Menu>
implements Attachable, org.patternfly.style.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()Sets the--pf-v5-c-menu__content--MaxHeightvariable to the specified valuestatic Menumenu(MenuType menuType, SelectionMode selectionMode) onAction(MenuActionHandler actionHandler) onMultiSelect(org.patternfly.handler.MultiSelectHandler<Menu, MenuItem> selectHandler) onSingleSelect(org.patternfly.handler.SelectHandler<MenuItem> selectHandler) voidvoidvoidvoidvoidvoidthat()Methods inherited from class org.patternfly.component.BaseComponent
componentType, elementMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jboss.elemento.ElementAttributeMethods
aria, aria, aria, attr, attr, attr, role, roleMethods inherited from interface org.jboss.elemento.ElementClassListMethods
classList, classList, css, toggle, toggle, toggleMethods inherited from interface org.jboss.elemento.ElementConsumerMethods
apply, runMethods inherited from interface org.jboss.elemento.ElementContainerMethods
add, add, add, add, addAll, addAll, addAll, addAll, addAll, addAllMethods inherited from interface org.jboss.elemento.ElementEventMethods
on, on, onMethods inherited from interface org.jboss.elemento.ElementIdMethods
id, uniqueIdMethods inherited from interface org.jboss.elemento.ElementQueryMethods
closest, querySelector, querySelectorAllMethods inherited from interface org.jboss.elemento.HTMLElementAttributeMethods
titleMethods inherited from interface org.jboss.elemento.HTMLElementDataMethods
dataMethods inherited from interface org.jboss.elemento.HTMLElementStyleMethods
style, style, style, style, style, styleMethods inherited from interface org.jboss.elemento.HTMLElementVisibilityMethods
hiddenMethods inherited from interface org.patternfly.style.Modifiers.Plain
plain, plain
-
Method Details
-
attach
- Specified by:
attachin interfaceAttachable
-
detach
- Specified by:
detachin interfaceAttachable
-
addHeader
Shortcut foraddHeader(menuHeader(text)) -
addDivider
-
favorites
-
flyout
-
height
Sets the--pf-v5-c-menu__content--MaxHeightvariable to the specified value -
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 ` -
select
-
select
-
select