Search in sources :

Example 21 with MenuBar

use of com.vaadin.flow.component.menubar.MenuBar in project layout-examples by vaadin.

the class PricingView method createTopMenu.

public Component createTopMenu() {
    MenuBar menuBar = new MenuBar();
    menuBar.addThemeVariants(MenuBarVariant.LUMO_TERTIARY);
    menuBar.addItem(new Anchor("#features", "Features"));
    menuBar.addItem(new Anchor("#enterprise", "Enterprise"));
    menuBar.addItem(new Anchor("#support", "Support"));
    menuBar.addItem(new Anchor("#pricing", "Pricing"));
    menuBar.addItem(new Button("Sign up"));
    return menuBar;
}
Also used : Anchor(com.vaadin.flow.component.html.Anchor) Button(com.vaadin.flow.component.button.Button) MenuBar(com.vaadin.flow.component.menubar.MenuBar)

Example 22 with MenuBar

use of com.vaadin.flow.component.menubar.MenuBar in project flow-components by vaadin.

the class MenuBarTest method removeNonChildItem_throws.

@Test(expected = IllegalArgumentException.class)
public void removeNonChildItem_throws() {
    MenuItem item = new MenuBar().addItem("foo");
    menuBar.remove(item);
}
Also used : MenuBar(com.vaadin.flow.component.menubar.MenuBar) MenuItem(com.vaadin.flow.component.contextmenu.MenuItem) Test(org.junit.Test)

Aggregations

MenuBar (com.vaadin.flow.component.menubar.MenuBar)22 MenuItem (com.vaadin.flow.component.contextmenu.MenuItem)9 Test (org.junit.jupiter.api.Test)8 Button (com.vaadin.flow.component.button.Button)6 lombok.val (lombok.val)6 SubMenu (com.vaadin.flow.component.contextmenu.SubMenu)3 TextField (com.vaadin.flow.component.textfield.TextField)3 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)2 ComponentEvent (com.vaadin.flow.component.ComponentEvent)1 ComponentEventListener (com.vaadin.flow.component.ComponentEventListener)1 Text (com.vaadin.flow.component.Text)1 Unit (com.vaadin.flow.component.Unit)1 Anchor (com.vaadin.flow.component.html.Anchor)1 Image (com.vaadin.flow.component.html.Image)1 Label (com.vaadin.flow.component.html.Label)1 Span (com.vaadin.flow.component.html.Span)1 Notification (com.vaadin.flow.component.notification.Notification)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 RouterLink (com.vaadin.flow.router.RouterLink)1 VaadinService (com.vaadin.flow.server.VaadinService)1