Skip to main content
Signature

Import

See this widget in action

Preview this widget and its behavior.

About this widget

The breadcrumb widget is a secondary navigation scheme that lets users see where the current page is in relation to the facet’s hierarchy. It reduces the number of actions a user needs to take to get to a higher-level page and improves the discoverability of the app or website’s sections and pages. It’s commonly used for websites with lot of data, organized into categories with subcategories.

Requirements

The objects to use in the breadcrumb must follow this structure:
JSON
It’s also possible to provide more than one path for each level:
JSON
To create a hierarchical menu:
  1. Decide on an appropriate facet hierarchy
  2. Determine your attributes for faceting from the dashboard or with an API client
  3. Display the UI with the hierarchical menu widget.
For more information, see Facet display. By default, the separator is > (with spaces), but you can use a different one by using the separator option. If there is also a hierarchicalMenu on the page, it must follow the same configuration.

Examples

JavaScript

Options

container
string | HTMLElement
required
The CSS Selector or HTMLElement to insert the widget into.
attributes
string[]
required
An array of attributes to generate the breadcrumb.
JavaScript
rootPath
string
The path to use if the first level is not the root level.Make sure to also include the root path in your UI state, for example, by setting initialUiState or calling setUiState().
JavaScript
separator
string
default:" > "
The level separator used in the .
JavaScript
templates
object
The templates to use for the widget.
JavaScript
cssClasses
object
The CSS classes you can override:
  • root. The root element of the widget.
  • noRefinementRoot. The root element if there are no refinements.
  • list. The list of results.
  • item. The list items. They contain the link and separator.
  • selectedItem. The selected item in the list. This is the last one, or the root one if there are no refinements.
  • separator. The separator.
  • link. The links in each item.
JavaScript
transformItems
function
A function that receives the list of items before they are displayed. It should return a new array with the same structure. Use this to transform, filter, or reorder the items.The function also has access to the full results data, including all standard response parameters and parameters from the helper, such as disjunctiveFacetsRefinements.
JavaScript

Templates

You can customize parts of a widget’s UI using the Templates API. Each template includes an html function, which you can use as a tagged template. This function safely renders templates as HTML strings and works directly in the browser—no build step required. For details, see Templating your UI.
The html function is available in InstantSearch.js version 4.46.0 or later.
home
string | function
The label of the breadcrumb’s first element.
separator
string | function
The symbol used to separate the elements of the breadcrumb.

HTML output

HTML

Customize the UI with connectBreadcrumb

If you want to create your own UI of the breadcrumb widget, you can use connectors. To use connectBreadcrumb, you can import it with the declaration relevant to how you installed InstantSearch.js.
Then it’s a 3-step process:
JavaScript

Create a render function

This rendering function is called before the first search (init lifecycle step) and each time results come back from Algolia (render lifecycle step).
JavaScript
If SEO is important for your search page, ensure that your custom HTML is optimized for search engines:
  • Use <a> tags with href attributes to allow search engine bots to follow links.
  • Use semantic HTML and include structured data when relevant.
For more guidance, see the SEO checklist.

Render options

items
object[]
required
The items to render, containing the keys:
  • label. The label of the category or subcategory.
  • value. The value of breadcrumb item.
JavaScript
canRefine
boolean
required
Indicates if search state can be refined.
JavaScript
widgetParams
object
All original widget options forwarded to the render function.
JavaScript

Create and instantiate the custom widget

First, create your custom widgets using a rendering function. Then, instantiate them with parameters. There are two kinds of parameters you can pass:
  • Instance parameters. Predefined options that configure Algolia’s behavior.
  • Custom parameters. Parameters you define to make the widget reusable and adaptable.
Inside the renderFunction, both instance and custom parameters are accessible through connector.widgetParams.
JavaScript

Instance options

attributes
string[]
required
The attributes to use to generate the hierarchy of the breadcrumb.
JavaScript
rootPath
string
The path to use if the first level is not the root level.Make sure to also include the root path in your UI state, for example, by setting initialUiState or calling setUiState().
JavaScript
separator
string
default:" > "
The level separator used in the records.
JavaScript
transformItems
function
A function that receives the list of items before they are displayed. It should return a new array with the same structure. Use this to transform, filter, or reorder the items.The function also has access to the full results data, including all standard response parameters and parameters from the helper, such as disjunctiveFacetsRefinements.
JavaScript

Full example

Last modified on July 10, 2026