Navigation in Breadcrumb

19 Dec 20223 minutes to read

The Breadcrumb item navigates to the path while clicking the item. To enable navigation, urlproperty was bound to the items.

URL

In the Breadcrumb component, the item represents the url. The Breadcrumb items can be provided with either relative or absolute URL.

Relative URL

The Breadcrumb items with relative URL contain only the path but do not locate the path or server. The following example represents the breadcrumb items with relative url.

<ejs-breadcrumb id="separatorTemplate" enableNavigation="false">
<e-breadcrumb-items>
    <e-breadcrumb-item text="Home" url="../"></e-breadcrumb-item>
    <e-breadcrumb-item text="Getting" url="./breadcrumb/getting-started"></e-breadcrumb-item>
    <e-breadcrumb-item text="Icons" url="./breadcrumb/icons"></e-breadcrumb-item>
    <e-breadcrumb-item text="Navigation" url="./breadcrumb/navigation"></e-breadcrumb-item>
    <e-breadcrumb-item text="Overflow" url="./breadcrumb/overflow"></e-breadcrumb-item>
</e-breadcrumb-items>
</ejs-breadcrumb>

ASP.NET Core Breadcrumb with Relative URL

Absolute URL

The Breadcrumb items with absolute URL contain the path and locate to the resource if the static url is bound to the breadcrumb item.

<ejs-breadcrumb id="separatorTemplate" enableNavigation="false">
<e-breadcrumb-items>
    <e-breadcrumb-item text="Home" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Getting" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Icons" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Navigation" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Overflow" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
</e-breadcrumb-items>
</ejs-breadcrumb>

ASP.NET Core Breadcrumb with Relative URL

Enable navigation for last Breadcrumb item

The feature enables the last item of the Breadcrumb component by setting the enableActiveItemNavigation property to true. In the following example, the last item of the Breadcrumb was enabled.

<ejs-breadcrumb id="default" enableNavigation="false" enableActiveItemNavigation="true">
<e-breadcrumb-items>
    <e-breadcrumb-item text="Home" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Getting" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Icons" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Navigation" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Overflow" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
</e-breadcrumb-items>
</ejs-breadcrumb>

ASP.NET Core Breadcrumb with Navigation Items

Open URL in new page or tab

To open the Breadcrumb item in a new page or tab, set the target property of the required item url to blank in the Breadcrumb component. In the following example, the target property of All Component item url was set to blank by using the beforeItemRender event which locates to the path in the new tab.

<ejs-breadcrumb id="separatorTemplate" beforeItemRender="beforeItemRender">
<e-breadcrumb-items>
    <e-breadcrumb-item text="Home" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Getting" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Icons" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Navigation" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
    <e-breadcrumb-item text="Overflow" url="https://ej2.syncfusion.com/home/aspnetcore.html#platform"></e-breadcrumb-item>
</e-breadcrumb-items>
</ejs-breadcrumb>

<script>
    function beforeItemRender(args) {
        if (args.element.children[0]) {
                args.element.children[0].target = "_blank";
            }
    }
</script>

ASP.NET Core Breadcrumb with New URL

NOTE

View Sample in GitHub.