Breadcrumb JAVASCRIPT UI Component API

Breadcrumb Javascript API

Class

Breadcrumb

Breadcrumbs allow users to make selections from a range of values.

Selector

smart-breadcrumb

Properties

AaddNewItemControls the visibility and functionality of the "Add new item" (+) button. When enabled, users can click the button to create and add new items. When disabled, the button is hidden or inactive, preventing the addition of new items.
AallowDragControls whether users can drag and reorder breadcrumb items. When enabled, breadcrumb items become draggable, allowing users to change their order within the breadcrumb navigation. When disabled, breadcrumb items remain static and cannot be moved.
AallowDropAllows you to control whether users can drop dragged breadcrumb items onto the breadcrumb navigation. When enabled, users can rearrange breadcrumb items by dragging and dropping them; when disabled, dropping is prevented.
AanimationSpecifies or retrieves the current animation mode. When set to 'none', all animations are disabled. Otherwise, this property determines how animations are applied to the element.
CcloseButtonsControls the visibility of the close (remove) button on individual breadcrumb items, allowing users to optionally display or hide the button for removing specific items from the breadcrumb navigation.
DdataSourceSpecifies the data source used to populate the breadcrumb items. The data should be provided as an array of objects, where each object represents an individual breadcrumb item with its corresponding properties, such as label, link, and any additional attributes required for display or navigation.
DdisabledControls whether the Breadcrumb navigation component is disabled. When enabled, the Breadcrumb provides users with a navigational trail;
IitemTemplateDefines the template used to render each breadcrumb item. This property accepts either the ID of an '<template>' element (as a string) or a reference to an actual 'HTMLTemplateElement'. When specified, the template determines the structure and content of each breadcrumb item. If set to 'null', the default rendering is used and no custom template is applied.
UunlockKeySets or retrieves the value of the unlockKey property, a unique key required to unlock and access the product's features. Use this property to specify the unlock key when enabling product access, or to obtain the current unlock key associated with the product.
LlocaleSets or retrieves the current language code (e.g., "en", "fr", "es") used for localization. This property works together with the messages property to select and display the appropriate translation strings based on the specified language.
MmessagesDefines or retrieves an object containing all user-facing text strings within the widget that can be localized. This object allows customization of the widget’s displayed text in different languages and works in conjunction with the locale property to support internationalization and localization. Use this property to provide translations for messages, labels, and other interface text in the widget.
MminimizeWidthSpecifies the minimum width (in pixels) at which the Breadcrumb component transitions from its normal display to a minimized mode. If this value is set to null, the Breadcrumb will always remain in its normal mode and will not automatically minimize, regardless of the container's width.
UunfocusableWhen set to true, this property prevents the element from receiving keyboard focus or being selected using keyboard navigation (such as with the Tab key). As a result, users will not be able to focus on this element using standard keyboard interactions.

Events

CcloseThis event is triggered whenever a breadcrumb item is removed or closed by the user—such as when a close icon within a breadcrumb segment is clicked. It can be used to detect and respond to changes in the breadcrumb navigation, allowing you to update application state, UI elements, or perform cleanup tasks as needed.
CclosingThis event is fired just before a Breadcrumb item begins the closing process. You can intercept and prevent the item from closing by invoking event.preventDefault() within your event handler. This allows you to add custom logic, such as displaying a confirmation dialog or validating conditions, before the Breadcrumb item is allowed to close.
DdragEndThis event is triggered when a user completes a drag-and-drop operation by dropping a Breadcrumb item into a new position. It signals that the item's placement has changed within the Breadcrumb navigation component and allows you to handle any necessary updates, such as reordering, data changes, or UI feedback.
DdraggingThis event is triggered when a user starts dragging a Breadcrumb item, allowing you to handle custom logic during the drag initiation phase. It provides access to the item being dragged and relevant drag event data.
AaddNewItemThis event is triggered whenever the user clicks the "Add new item" (+) button. It typically indicates the user's intent to create or insert a new item into the current list, collection, or data structure. The event can be used to initialize the process for adding a new item, display a relevant input form, or handle any additional logic associated with item creation.

Methods

AaddItemAdds a new item to the collection. The item is appended to the end of the array or list, increasing the total number of items by one. If additional properties (such as item details or metadata) are required, ensure they are included in the request.
MmaximizeRestores the Breadcrumb component from its minimized or collapsed state to its full, expanded view, making all breadcrumb navigation links visible to the user.
MminimizeCollapses the breadcrumb navigation into a minimal or condensed state, reducing its visual footprint on the page while still maintaining navigational functionality. This is typically used to save space or enhance the user interface on smaller screens.
RremoveItemRemoves a specified item from the collection. If the item exists, it will be deleted; otherwise, no action is taken.

Properties

addNewItemboolean

Controls the visibility and functionality of the "Add new item" (+) button. When enabled, users can click the button to create and add new items. When disabled, the button is hidden or inactive, preventing the addition of new items.

Default value

false

Example

Set the addNewItem property.

 <smart-breadcrumb add-new-item></smart-breadcrumb>

Set the addNewItem property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.addNewItem = false;

Get the addNewItem property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let addNewItem = breadcrumb.addNewItem;

allowDragboolean

Controls whether users can drag and reorder breadcrumb items. When enabled, breadcrumb items become draggable, allowing users to change their order within the breadcrumb navigation. When disabled, breadcrumb items remain static and cannot be moved.

Default value

false

Example

Set the allowDrag property.

 <smart-breadcrumb allow-drag></smart-breadcrumb>

Set the allowDrag property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.allowDrag = false;

Get the allowDrag property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let allowDrag = breadcrumb.allowDrag;

allowDropboolean

Allows you to control whether users can drop dragged breadcrumb items onto the breadcrumb navigation. When enabled, users can rearrange breadcrumb items by dragging and dropping them; when disabled, dropping is prevented.

Default value

false

Example

Set the allowDrop property.

 <smart-breadcrumb allow-drop></smart-breadcrumb>

Set the allowDrop property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.allowDrop = false;

Get the allowDrop property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let allowDrop = breadcrumb.allowDrop;

animation"none" | "simple" | "advanced"

Specifies or retrieves the current animation mode. When set to 'none', all animations are disabled. Otherwise, this property determines how animations are applied to the element.

Allowed Values

  • "none" - animation is disabled
  • "simple" - ripple animation is disabled
  • "advanced" - all animations are enabled

Default value

"advanced"

Example

Set the animation property.

 <smart-breadcrumb animation='none'></smart-breadcrumb>

Set the animation property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.animation = 'simple';

Get the animation property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let animation = breadcrumb.animation;

closeButtonsboolean

Controls the visibility of the close (remove) button on individual breadcrumb items, allowing users to optionally display or hide the button for removing specific items from the breadcrumb navigation.

Default value

false

Example

Set the closeButtons property.

 <smart-breadcrumb close-buttons></smart-breadcrumb>

Set the closeButtons property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.closeButtons = false;

Get the closeButtons property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let closeButtons = breadcrumb.closeButtons;

dataSource{label: string, value: string}[]

Specifies the data source used to populate the breadcrumb items. The data should be provided as an array of objects, where each object represents an individual breadcrumb item with its corresponding properties, such as label, link, and any additional attributes required for display or navigation.

Default value

[]

Example

Set the dataSource property.

 <smart-breadcrumb data-source='[{ "label": "Planets", "value": "A" }, { "label": "Continents", "value": "B" }]'></smart-breadcrumb>

Set the dataSource property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.dataSource = [{ "label": "Countries", "value": "C" }, { "label": "States", "value": "D" }];

Get the dataSource property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let dataSource = breadcrumb.dataSource;

disabledboolean

Controls whether the Breadcrumb navigation component is disabled. When enabled, the Breadcrumb provides users with a navigational trail;

Default value

false

Example

Set the disabled property.

 <smart-breadcrumb disabled></smart-breadcrumb>

Set the disabled property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.disabled = false;

Get the disabled property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let disabled = breadcrumb.disabled;

itemTemplateany

Defines the template used to render each breadcrumb item. This property accepts either the ID of an '<template>' element (as a string) or a reference to an actual 'HTMLTemplateElement'. When specified, the template determines the structure and content of each breadcrumb item. If set to 'null', the default rendering is used and no custom template is applied.

Example

Set the itemTemplate property.

 <smart-breadcrumb item-template='template1'></smart-breadcrumb>

Set the itemTemplate property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.itemTemplate = document.getElementsByTagName('template')[0];

Get the itemTemplate property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let itemTemplate = breadcrumb.itemTemplate;

unlockKeystring

Sets or retrieves the value of the unlockKey property, a unique key required to unlock and access the product's features. Use this property to specify the unlock key when enabling product access, or to obtain the current unlock key associated with the product.

Default value

""

Example

Set the unlockKey property.

 <smart-breadcrumb unlock-key=''></smart-breadcrumb>

Set the unlockKey property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.unlockKey = '1111-2222-3333-4444-5555';

Get the unlockKey property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let unlockKey = breadcrumb.unlockKey;

localestring

Sets or retrieves the current language code (e.g., "en", "fr", "es") used for localization. This property works together with the messages property to select and display the appropriate translation strings based on the specified language.

Default value

"en"

Example

Set the locale property.

 <smart-breadcrumb locale='de'></smart-breadcrumb>

Set the locale property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.locale = 'en';

Get the locale property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let locale = breadcrumb.locale;

messagesobject

Defines or retrieves an object containing all user-facing text strings within the widget that can be localized. This object allows customization of the widget’s displayed text in different languages and works in conjunction with the locale property to support internationalization and localization. Use this property to provide translations for messages, labels, and other interface text in the widget.

Default value




"en": {

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to {{files}}.",

"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."

}

Example

Set the messages property.

 <smart-breadcrumb messages='{"de":{"propertyUnknownType":"Die Eigenschaft '{{name}}' hat ein nicht definiertes 'type'-Member!","propertyInvalidValue":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualValue}}, Erwarteter Wert: {{value}}!","propertyInvalidValueType":"Ungultiger Eigenschaftswert '{{name}}'! Aktueller Wert: {{actualType}}, Erwarteter Wert: {{type}}!","elementNotInDOM":"Element existiert nicht in DOM! Bitte fugen Sie das Element zum DOM hinzu, bevor Sie eine Methode aufrufen.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss."}}'></smart-breadcrumb>

Set the messages property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}};

Get the messages property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let messages = breadcrumb.messages;

minimizeWidthnumber

Specifies the minimum width (in pixels) at which the Breadcrumb component transitions from its normal display to a minimized mode. If this value is set to null, the Breadcrumb will always remain in its normal mode and will not automatically minimize, regardless of the container's width.

Example

Set the minimizeWidth property.

 <smart-breadcrumb minimize-width='100'></smart-breadcrumb>

Set the minimizeWidth property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.minimizeWidth = 200;

Get the minimizeWidth property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let minimizeWidth = breadcrumb.minimizeWidth;

unfocusableboolean

When set to true, this property prevents the element from receiving keyboard focus or being selected using keyboard navigation (such as with the Tab key). As a result, users will not be able to focus on this element using standard keyboard interactions.

Default value

false

Example

Set the unfocusable property.

 <smart-breadcrumb unfocusable></smart-breadcrumb>

Set the unfocusable property by using the HTML Element's instance.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 breadcrumb.unfocusable = false;

Get the unfocusable property.

 const breadcrumb = document.querySelector('smart-breadcrumb');
 let unfocusable = breadcrumb.unfocusable;

Events

closeCustomEvent

This event is triggered whenever a breadcrumb item is removed or closed by the user—such as when a close icon within a breadcrumb segment is clicked. It can be used to detect and respond to changes in the breadcrumb navigation, allowing you to update application state, UI elements, or perform cleanup tasks as needed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onClose

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - The item that has been closed.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of close event.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addEventListener('close', function (event) {
    const detail = event.detail,
        item = detail.item;

	// event handling code goes here.
})

closingCustomEvent

This event is fired just before a Breadcrumb item begins the closing process. You can intercept and prevent the item from closing by invoking event.preventDefault() within your event handler. This allows you to add custom logic, such as displaying a confirmation dialog or validating conditions, before the Breadcrumb item is allowed to close.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onClosing

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - The item that is going to be closed.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of closing event.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addEventListener('closing', function (event) {
    const detail = event.detail,
        item = detail.item;

	// event handling code goes here.
})

dragEndCustomEvent

This event is triggered when a user completes a drag-and-drop operation by dropping a Breadcrumb item into a new position. It signals that the item's placement has changed within the Breadcrumb navigation component and allows you to handle any necessary updates, such as reordering, data changes, or UI feedback.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDragEnd

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dragEnd event.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addEventListener('dragEnd', function (event) {
	// event handling code goes here.
})

draggingCustomEvent

This event is triggered when a user starts dragging a Breadcrumb item, allowing you to handle custom logic during the drag initiation phase. It provides access to the item being dragged and relevant drag event data.

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDragging

Arguments

evCustomEvent
ev.detailObject
ev.detail.item - The item that is being dragged.
ev.detail.originalEvent - The original event that initiates the dragging operation.
ev.detail.target - The original target.

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dragging event.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addEventListener('dragging', function (event) {
    const detail = event.detail,
        item = detail.item,
        originalEvent = detail.originalEvent,
        target = detail.target;

	// event handling code goes here.
})

addNewItemCustomEvent

This event is triggered whenever the user clicks the "Add new item" (+) button. It typically indicates the user's intent to create or insert a new item into the current list, collection, or data structure. The event can be used to initialize the process for adding a new item, display a relevant input form, or handle any additional logic associated with item creation.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onAddNewItem

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of addNewItem event.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addEventListener('addNewItem', function (event) {
	// event handling code goes here.
})

Methods

addItem( itemDetails: any): void

Adds a new item to the collection. The item is appended to the end of the array or list, increasing the total number of items by one. If additional properties (such as item details or metadata) are required, ensure they are included in the request.

Arguments

itemDetailsany

An Object with the fields "index", "label", and "value".


Invoke the addItem method.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.addItem("{ index: 3, label: 'Districts', value: 'F' }");

maximize(): void

Restores the Breadcrumb component from its minimized or collapsed state to its full, expanded view, making all breadcrumb navigation links visible to the user.


Invoke the maximize method.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.maximize();

minimize(): void

Collapses the breadcrumb navigation into a minimal or condensed state, reducing its visual footprint on the page while still maintaining navigational functionality. This is typically used to save space or enhance the user interface on smaller screens.


Invoke the minimize method.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.minimize();

removeItem( item: HTMLElement): void

Removes a specified item from the collection. If the item exists, it will be deleted; otherwise, no action is taken.

Arguments

itemHTMLElement

The item to remove.


Invoke the removeItem method.

const breadcrumb = document.querySelector('smart-breadcrumb');
breadcrumb.removeItem("document.getElementsByClassName('smart-breadcrumb-item')[0]");

CSS Variables

--smart-breadcrumb-default-widthvar()

Default value

"400px"

smartBreadcrumb default width

--smart-breadcrumb-default-heightvar()

Default value

"auto"

smartBreadcrumb default height

--smart-breadcrumb-paddingvar()

Default value

"10px"

Padding of smart-breadcrumb and vertical offset between smartBreadcrumb items

--smart-breadcrumb-drop-down-widthvar()

Default value

"var(--smart-editor-drop-down-width)"

Width of smartBreadcrumb dropdown in minimized mode

--smart-breadcrumb-item-heightvar()

Default value

"40px"

Height of smartBreadcrumb items

--smart-breadcrumb-horizontal-offsetvar()

Default value

"10px"

Horizontal offset between smartBreadcrumb items