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

    Constructors
    Constructor
    Description
    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.
    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 Type
    Method
    Description
    Gets the path this item links to.
    void
    setPath(Class<? extends com.vaadin.flow.component.Component> view)
    Resolves the URL of the given view via the Vaadin router and sets it as the path this item links to.
    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.
    void
    Sets 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, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.shared.HasPrefix

    getPrefixComponent, setPrefixComponent

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    bindText, getText, getWhiteSpace, setText, setWhiteSpace
  • Constructor Details

    • BreadcrumbsItem

      public BreadcrumbsItem(String text)
      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

      public BreadcrumbsItem(String text, String path)
      Creates a breadcrumbs item with the given text that links to the given path.
      Parameters:
      text - the text of the item
      path - the path to link to
    • BreadcrumbsItem

      public 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.
      Parameters:
      text - the text of the item
      view - 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 item
      view - the view to link to
      params - 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 item
      path - the path to link to
      prefixComponent - 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 item
      view - the view to link to
      prefixComponent - 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 item
      view - the view to link to
      params - the route parameters
      prefixComponent - the prefix component for the item (usually an icon)
  • Method Details

    • getPath

      public String getPath()
      Gets the path this item links to.
      Returns:
      the path this item links to, or null if the item has no path
    • setPath

      public void setPath(String path)
      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, or null to remove the path and render the item as the current page (a non-link)
      See Also:
    • setPath

      public void setPath(Class<? extends com.vaadin.flow.component.Component> view)
      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 the Route annotation. Set to null to 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 the Route annotation. Set to null to remove the path.
      parameters - the route parameters
      See Also: