Class SideNav
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.sidenav.SideNav
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,HasSideNavItems,Serializable
@Tag("vaadin-side-nav")
@NpmPackage(value="@vaadin/side-nav",
version="25.0.0-alpha16")
@JsModule("@vaadin/side-nav/src/vaadin-side-nav.js")
public class SideNav
extends com.vaadin.flow.component.Component
implements HasSideNavItems, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
A side navigation menu with support for hierarchical and flat menus.
Items can be added using HasSideNavItems.addItem(SideNavItem...) and hierarchy can
be created by adding SideNavItem instances to other
SideNavItem instances.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetI18n()Gets the internationalization object previously set for this component.getLabel()Gets the label of this side navigation menu.booleanCheck if the end user is allowed to collapse/hide and expand/show the navigation items.booleanReturns whether the side navigation menu is expanded or collapsed.voidsetCollapsible(boolean collapsible) Allow the end user to collapse/hide and expand/show the navigation items.voidsetExpanded(boolean expanded) Expands the side navigation menu.voidsetI18n(SideNav.SideNavI18n i18n) Updates the i18n settings in the web component.voidSet a textual label for this side navigation menu.Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.sidenav.HasSideNavItems
addItem, addItemAsFirst, addItemAtIndex, getItems, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
SideNav
public SideNav()Creates a new menu without any label. -
SideNav
Creates a new menu with the given label.- Parameters:
label- the label to use
-
-
Method Details
-
getLabel
Gets the label of this side navigation menu.- Returns:
- the label or null if no label has been set
-
setLabel
Set a textual label for this side navigation menu.This label can help the end user to distinguish groups of navigation items. The label is also available for screen reader users.
- Parameters:
label- the label text to set; or null to remove the label
-
isCollapsible
public boolean isCollapsible()Check if the end user is allowed to collapse/hide and expand/show the navigation items.NOTE: The navigation has to have a label for it to be collapsible.
- Returns:
- true if the menu is collapsible, false otherwise
-
setCollapsible
public void setCollapsible(boolean collapsible) Allow the end user to collapse/hide and expand/show the navigation items.NOTE: The navigation has to have a label for it to be collapsible.
- Parameters:
collapsible- true to make the whole navigation component collapsible, false otherwise
-
isExpanded
@Synchronize(property="collapsed", value="collapsed-changed", allowInert=true) public boolean isExpanded()Returns whether the side navigation menu is expanded or collapsed.- Returns:
- true if the side navigation menu is expanded, false if collapsed
-
setExpanded
public void setExpanded(boolean expanded) Expands the side navigation menu.If the side navigation menu does not have a label, does nothing.
-
getI18n
Gets the internationalization object previously set for this component.NOTE: Updating the instance that is returned from this method will not update the component if not set again using
setI18n(SideNavI18n)- Returns:
- the i18n object or
nullif no i18n object has been set
-