Interface HasMenuItems

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      MenuItem addItem​(com.vaadin.flow.component.Component component, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener)
      Adds a new item component with the given component and click listener to the context menu overlay.
      MenuItem addItem​(String text, com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener)
      Adds a new item component with the given text content and click listener to the context menu overlay.
    • Method Detail

      • addItem

        MenuItem addItem​(com.vaadin.flow.component.Component component,
                         com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<MenuItem>> clickListener)
        Adds a new item component with the given component and click listener to the context menu overlay.

        This is a convenience method for the use case where you have a list of highlightable MenuItems inside the overlay. If you want to configure the contents of the overlay without wrapping them inside MenuItems, or if you just want to add some non-highlightable components between the items, use the ContextMenuBase.add(Component...) method.

        Parameters:
        component - the component inside the new item
        clickListener - the handler for clicking the new item, can be null to not add listener
        Returns:
        the added MenuItem component
        See Also:
        addItem(String, ComponentEventListener), ContextMenuBase.add(Component...), SubMenuBase.add(Component...)