Breadcrumbs
Overview
Breadcrumbs in Servoy is a UI component used for navigation that provides a trail of links representing the user's current location within the application, usually in a hierarchical manner. This allows users to easily navigate back to previous forms or pages by clicking on the links in the breadcrumb trail.
The Breadcrumbs component wraps the standard Bootstrap breadcrumbs used to display navigational hierarchy.
Breadcrumbs are particularly useful in applications with a multi-level navigation structure or complex workflows, where users need to track where they are and how they reached the current page. They give users a quick way to backtrack to higher-level forms or sections of the application without using traditional back/forward buttons or re-navigating through the menus.
Key Features of Breadcrumbs:
Hierarchical Navigation: Breadcrumbs display the user's navigation path in a hierarchical order. Each segment in the breadcrumb trail represents a form or a section, and users can click on any segment to go back to that point in the navigation history.
Improves User Experience: Breadcrumbs make navigation more intuitive by providing users with a clear sense of their location within the application's hierarchy. This is especially helpful in applications with deep navigation layers or complex workflows.
Contextual Backtracking: Unlike using a back button (which follows strict history order), breadcrumbs allow the user to jump back to any previous section in the hierarchy, making it easier to navigate to higher-level forms or modules. Dynamic Generation: Breadcrumbs are often generated dynamically based on the user's navigation history. Each time the user navigates to a new form, the breadcrumb trail updates to reflect the new location. Customization: Breadcrumb components in Servoy can be customized to fit the design and functionality of the application. You can choose the labels for each segment of the breadcrumb and control how they respond when clicked.
Use Cases for Breadcrumbs
Hierarchical Applications: In applications with a hierarchical structure, breadcrumbs help users understand their current location and navigate between different levels of the hierarchy. For example, in an e-commerce application, a breadcrumb might track the user's path from Home to Categories to a specific Product.
Multi-Step Processes: Breadcrumbs can be used to guide users through a multi-step process, such as a wizard or checkout flow. The breadcrumbs visually represent each step, and users can click on previous steps to review or change information.
Drill-Down Navigation: Breadcrumbs are useful when users are drilling down into data or categories. They allow users to easily retrace their steps back to higher-level categories or forms without having to use the back button or main navigation.
Get Started
Creating a Breadcrumbs component
Here are the steps for creating a Breadcrumbs component:
Open the Form Editor of the form where you need to place a Breadcrumbs component
Find Breadcrumbs in Navigation section in the components' pallet
Drag and drop the Breadcrumbs component in the desired place of the form
Set the crumbs; this can be done via properties panel
Edit other Breadcrumbs properties and Breadcrumbs crumb properties
Setting the crumbs (in the properties panel)
After dragging the component on the form, find the Breadcrumbs in the form editor, click it and proceed with the following steps:
Add a crumb. There are 2 ways of adding a crumb:
Select the
breadcrumbs
property and click the+
button in order to add a crumb. Next crumbs can be added the same way or by clicking the+
button (insert a new array item below
) of another crumb. You can change the crumbs' order by dragging them into the desired placed inside the Breadcrumbs (in the form editor).Drag and drop
crumb
component (of an Breadcrumbs in Navigation section in the components' pallet) into the Breadcrumbs component (in the form editor)
Expand the
breadcrumbs
property to see the list of crumbs. They are also shown in the Breadcrumbs component (in the form editor)In order to edit each crumb, expand it or click the crumb name in the Breadcrumbs component (in the form editor) and set its properties:
Set an unique crumb id
Set a display name corresponding to each id
Breadcrumbs crumb
It is necessary to set an unique id in the Breadcrumbs crumb crumbID property.
Example: home_page
.
Scripting Breadcrumbs
Main events
You can find a list of Breadcrumbs events here. You can find a list of Breadcrumbs API methods here.
onCrumbClicked
This event is called when a breadcrumb item is clicked. Here is an example of how to use the onCrumbClicked event of Breadcrumbs in the Scripting Editor:
Let's consider the following setup:
main_form
: the form where the Breadcrumbs component is placed, together with a form container component,fc_steps
Breadcrumbs component has the following crumbs:
crumb
:step1
,displayName
:Step 1
crumb
:step2
,displayName
:Step 2
crumb
:step3
,displayName
:Step 3
separate forms showed in
main_form
as a contained form in the form container component:step1
,step2
,step3
.
The following goes on main_form
script file:
Add a crumb
Here is an example of how to programmatically add a crumb in the Scripting Editor of the main form, using the the addCrumb API:
Remove a crumb after a certain index
Here is an example of how to programmatically remove a crumb after a certain index in the Scripting Editor of the main form, using the the removeCrumbsAfter API:
Remove the last crumb
Here is an example of how to programmatically remove the last crumb in the Scripting Editor of the main form, using the the removeLastCrumb API:
Setting the crumbs
Here is an example of how to programmatically set the crumbs in the Scripting Editor of the main form, using the the setCrumbs API:
Last updated