Search in sources :

Example 71 with Icon

use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.

the class AppLayoutDrawer method createTab.

private Tab createTab(VaadinIcon viewIcon, String viewName) {
    Icon icon = viewIcon.create();
    icon.getStyle().set("box-sizing", "border-box").set("margin-inline-end", "var(--lumo-space-m)").set("padding", "var(--lumo-space-xs)");
    RouterLink link = new RouterLink();
    link.add(icon, new Span(viewName));
    // Demo has no routes
    // link.setRoute(viewClass.java);
    link.setTabIndex(-1);
    return new Tab(link);
}
Also used : RouterLink(com.vaadin.flow.router.RouterLink) Tab(com.vaadin.flow.component.tabs.Tab) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span)

Example 72 with Icon

use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.

the class AppLayoutNavbarPlacement method createTab.

private Tab createTab(VaadinIcon viewIcon, String viewName) {
    Icon icon = viewIcon.create();
    icon.getStyle().set("box-sizing", "border-box").set("margin-inline-end", "var(--lumo-space-m)").set("margin-inline-start", "var(--lumo-space-xs)").set("padding", "var(--lumo-space-xs)");
    RouterLink link = new RouterLink();
    link.add(icon, new Span(viewName));
    // Demo has no routes
    // link.setRoute(viewClass.java);
    link.setTabIndex(-1);
    return new Tab(link);
}
Also used : RouterLink(com.vaadin.flow.router.RouterLink) Tab(com.vaadin.flow.component.tabs.Tab) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span)

Example 73 with Icon

use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.

the class AppLayoutNavbarPlacementSide method createTab.

private Tab createTab(VaadinIcon viewIcon, String viewName) {
    Icon icon = viewIcon.create();
    icon.getStyle().set("box-sizing", "border-box").set("margin-inline-end", "var(--lumo-space-m)").set("padding", "var(--lumo-space-xs)");
    RouterLink link = new RouterLink();
    link.add(icon, new Span(viewName));
    // Demo has no routes
    // link.setRoute(viewClass.java);
    link.setTabIndex(-1);
    return new Tab(link);
}
Also used : RouterLink(com.vaadin.flow.router.RouterLink) Tab(com.vaadin.flow.component.tabs.Tab) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon) Span(com.vaadin.flow.component.html.Span)

Example 74 with Icon

use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.

the class BadgeIconsOnly method createIcon.

// tag::snippet2[]
private Icon createIcon(VaadinIcon vaadinIcon, String label) {
    Icon icon = vaadinIcon.create();
    icon.getStyle().set("padding", "var(--lumo-space-xs");
    // Accessible label
    icon.getElement().setAttribute("aria-label", label);
    // Tooltip
    icon.getElement().setAttribute("title", label);
    return icon;
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 75 with Icon

use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.

the class BadgeIconsOnlyTable method createIcon.

private Icon createIcon(VaadinIcon vaadinIcon, String label) {
    Icon icon = vaadinIcon.create();
    icon.getStyle().set("padding", "var(--lumo-space-xs");
    // Accessible label
    icon.getElement().setAttribute("aria-label", label);
    // Tooltip
    icon.getElement().setAttribute("title", label);
    return icon;
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Aggregations

Icon (com.vaadin.flow.component.icon.Icon)110 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)94 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)46 Button (com.vaadin.flow.component.button.Button)39 Span (com.vaadin.flow.component.html.Span)21 Div (com.vaadin.flow.component.html.Div)19 ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)18 Tab (com.vaadin.flow.component.tabs.Tab)16 Text (com.vaadin.flow.component.Text)15 Test (org.junit.Test)12 EnhancedButton (org.komunumo.ui.component.EnhancedButton)12 Grid (com.vaadin.flow.component.grid.Grid)10 RouterLink (com.vaadin.flow.router.RouterLink)9 Notification (com.vaadin.flow.component.notification.Notification)8 Component (com.vaadin.flow.component.Component)7 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)7 Anchor (com.vaadin.flow.component.html.Anchor)7 TextField (com.vaadin.flow.component.textfield.TextField)7 UI (com.vaadin.flow.component.UI)6 StreamResource (com.vaadin.flow.server.StreamResource)6