Class Breadcrumbs

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.breadcrumbs.Breadcrumbs
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<BreadcrumbsVariant>, Serializable

@Tag("vaadin-breadcrumbs") @NpmPackage(value="@vaadin/breadcrumbs", version="25.2.3") @JsModule("@vaadin/breadcrumbs/src/vaadin-breadcrumbs.js") public class Breadcrumbs extends com.vaadin.flow.component.Component implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>, com.vaadin.flow.component.shared.HasThemeVariant<BreadcrumbsVariant>
Breadcrumbs is a component for displaying a navigation trail that shows the user's location within a hierarchy of pages.

This component is experimental and needs to be enabled with the com.vaadin.experimental.breadcrumbsComponent feature flag.

Since:
25.2
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The internationalization properties for Breadcrumbs.
    static enum 
    The mode that determines how the breadcrumb trail is populated.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new breadcrumbs component in Breadcrumbs.Mode.ROUTER mode.
    Creates a new breadcrumbs component in the given mode.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(BreadcrumbsItem... components)
     
    void
     
    void
     
    void
    addComponentAtIndex(int index, BreadcrumbsItem component)
     
    <V extends @Nullable Object, S extends com.vaadin.flow.signals.Signal<V>>
    void
    bindChildren(com.vaadin.flow.signals.Signal<List<S>> list, com.vaadin.flow.function.SerializableFunction<S,BreadcrumbsItem> childFactory)
     
    Gets the internationalization object previously set for this component.
    Gets the mode that determines how the breadcrumb trail is populated.
    protected void
    onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
     
    protected void
    onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
     
    void
    remove(BreadcrumbsItem... components)
     
    void
     
    void
     
    void
    replace(BreadcrumbsItem oldComponent, BreadcrumbsItem newComponent)
     
    void
    Sets the internationalization properties for this component.
    void
    Sets the mode that determines how the breadcrumb trail is populated.

    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, 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.HasAriaLabel

    getAriaLabel, getAriaLabelledBy, setAriaLabel, setAriaLabelledBy, setAriaLabelledBy

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

    getChildren, getComponentAt, getComponentCount, indexOf

    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.HasSize

    bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    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.HasTheme

    addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName

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

    addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariants
  • Constructor Details

    • Breadcrumbs

      public Breadcrumbs()
      Creates a new breadcrumbs component in Breadcrumbs.Mode.ROUTER mode.
    • Breadcrumbs

      public Breadcrumbs(Breadcrumbs.Mode mode)
      Creates a new breadcrumbs component in the given mode.
      Parameters:
      mode - the mode that determines how the trail is populated, not null
  • Method Details

    • getMode

      public Breadcrumbs.Mode getMode()
      Gets the mode that determines how the breadcrumb trail is populated.
      Returns:
      the current mode
    • setMode

      public void setMode(Breadcrumbs.Mode newMode)
      Sets the mode that determines how the breadcrumb trail is populated.

      Switching to a different mode discards the existing children: both the ROUTER -> MANUAL and MANUAL -> ROUTER transitions clear the current trail so the new mode can start fresh. Setting the mode to its current value is a no-op and leaves the children untouched.

      Parameters:
      newMode - the mode that determines how the trail is populated, not null
      Throws:
      IllegalStateException - if a children binding set via bindChildren is active; such a binding takes over the trail and cannot be handed back to component-controlled population
    • add

      public void add(BreadcrumbsItem... components)
      Specified by:
      add in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • add

      public void add(Collection<BreadcrumbsItem> components)
      Specified by:
      add in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • remove

      public void remove(BreadcrumbsItem... components)
      Specified by:
      remove in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • remove

      public void remove(Collection<BreadcrumbsItem> components)
      Specified by:
      remove in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • addComponentAsFirst

      public void addComponentAsFirst(BreadcrumbsItem component)
      Specified by:
      addComponentAsFirst in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • addComponentAtIndex

      public void addComponentAtIndex(int index, BreadcrumbsItem component)
      Specified by:
      addComponentAtIndex in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • replace

      public void replace(BreadcrumbsItem oldComponent, BreadcrumbsItem newComponent)
      Specified by:
      replace in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • bindChildren

      public <V extends @Nullable Object, S extends com.vaadin.flow.signals.Signal<V>> void bindChildren(com.vaadin.flow.signals.Signal<List<S>> list, com.vaadin.flow.function.SerializableFunction<S,BreadcrumbsItem> childFactory)
      Specified by:
      bindChildren in interface com.vaadin.flow.component.HasComponentsOfType<BreadcrumbsItem>
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • getI18n

      public Breadcrumbs.BreadcrumbsI18n 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(BreadcrumbsI18n)

      Returns:
      the i18n object or null if no i18n object has been set
    • setI18n

      public void setI18n(Breadcrumbs.BreadcrumbsI18n i18n)
      Sets the internationalization properties for this component.
      Parameters:
      i18n - the i18n object, not null