Class BreadcrumbsItem
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.breadcrumbs.BreadcrumbsItem
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasText,com.vaadin.flow.component.shared.HasPrefix,Serializable
@Tag("vaadin-breadcrumbs-item")
@NpmPackage(value="@vaadin/breadcrumbs",
version="25.2.0-beta1")
@JsModule("@vaadin/breadcrumbs/src/vaadin-breadcrumbs-item.js")
public class BreadcrumbsItem
extends com.vaadin.flow.component.Component
implements com.vaadin.flow.component.HasText, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.shared.HasPrefix
An item of the
Breadcrumbs component, representing a single entry in
the navigation trail.
An item carries the text shown in the trail and, optionally, a path
it links to. An item without a path is the current page and is rendered as a
non-link. The link target can be set as a plain URL string via
setPath(String) or resolved from a Flow route class via
setPath(Class) / setPath(Class, RouteParameters). An
optional prefix component (typically an icon) can be shown before the text.
- Author:
- Vaadin Ltd
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpace -
Constructor Summary
ConstructorsConstructorDescriptionBreadcrumbsItem(String text) Creates a breadcrumbs item with the given text and no path.BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view) Creates a breadcrumbs item with the given text that links to the given view.BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given view.BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters params) Creates a breadcrumbs item with the given text that links to the given view using the given route parameters.BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters params, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given view using the given route parameters.BreadcrumbsItem(String text, String path) Creates a breadcrumbs item with the given text that links to the given path.BreadcrumbsItem(String text, String path, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given path. -
Method Summary
Modifier and TypeMethodDescriptiongetPath()Gets the path this item links to.voidResolves the URL of the given view via the Vaadin router and sets it as the path this item links to.voidsetPath(Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters parameters) Resolves the URL of the given view via the Vaadin router using the given route parameters and sets it as the path this item links to.voidSets the path, as a URL string, this item links to.Methods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, 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.HasEnabled
bindEnabled, isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
bindText, getText, getWhiteSpace, setText, setWhiteSpace
-
Constructor Details
-
BreadcrumbsItem
Creates a breadcrumbs item with the given text and no path. An item without a path represents the current page and is rendered as a non-link.- Parameters:
text- the text of the item
-
BreadcrumbsItem
Creates a breadcrumbs item with the given text that links to the given path.- Parameters:
text- the text of the itempath- the path to link to
-
BreadcrumbsItem
Creates a breadcrumbs item with the given text that links to the given view.- Parameters:
text- the text of the itemview- the view to link to
-
BreadcrumbsItem
public BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters params) Creates a breadcrumbs item with the given text that links to the given view using the given route parameters.- Parameters:
text- the text of the itemview- the view to link toparams- the route parameters
-
BreadcrumbsItem
public BreadcrumbsItem(String text, String path, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given path.- Parameters:
text- the text of the itempath- the path to link toprefixComponent- the prefix component for the item (usually an icon)
-
BreadcrumbsItem
public BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given view.- Parameters:
text- the text of the itemview- the view to link toprefixComponent- the prefix component for the item (usually an icon)
-
BreadcrumbsItem
public BreadcrumbsItem(String text, Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters params, com.vaadin.flow.component.Component prefixComponent) Creates a breadcrumbs item with the given text and prefix component (like an icon) that links to the given view using the given route parameters.- Parameters:
text- the text of the itemview- the view to link toparams- the route parametersprefixComponent- the prefix component for the item (usually an icon)
-
-
Method Details
-
getPath
Gets the path this item links to.- Returns:
- the path this item links to, or
nullif the item has no path
-
setPath
Sets the path, as a URL string, this item links to.Note that there is also an alternative way of setting the link path via
setPath(Class).- Parameters:
path- the path to link to, ornullto remove the path and render the item as the current page (a non-link)- See Also:
-
setPath
Resolves the URL of the given view via the Vaadin router and sets it as the path this item links to.- Parameters:
view- the view to link to. The view should be annotated with theRouteannotation. Set tonullto remove the path.- See Also:
-
setPath
public void setPath(Class<? extends com.vaadin.flow.component.Component> view, com.vaadin.flow.router.RouteParameters parameters) Resolves the URL of the given view via the Vaadin router using the given route parameters and sets it as the path this item links to.- Parameters:
view- the view to link to. The view should be annotated with theRouteannotation. Set tonullto remove the path.parameters- the route parameters- See Also:
-