Signature
Import
- Component
- Plugin
To ensure optimal bundle sizes,
see Optimize build size.
Vue
About this widget
Theais-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 lots of data,
organized into categories with subcategories.
Requirements
Breadcrumbs objects must have this structure:JSON
JSON
- Decide on an appropriate facet hierarchy
- Determine your
attributes
for faceting from the dashboard or with an API client - Display the UI with the hierarchical menu widget.
>
(with spaces),
but you can use a different one by using the separator
option.
If there is also a ais-hierarchical-manu
on the page,
it must follow the same configuration.
Examples
Vue
Props
An array of attributes to generate the breadcrumb.
To prevent creating infinite loops,
avoid passing arrays, objects, or functions directly in the template.
These values aren’t referentially equal on each render,
which causes the widget to re-register every time.
Instead, define them in your component’s
data
option and reference them in the template.Vue
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
initial-ui-state
.Vue
The level separator used in the records.
Vue
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
.Vue
The CSS classes you can override:
ais-Breadcrumb
. The root element of the widget.ais-Breadcrumb--noRefinement
. The root element of the widget with no refinement.ais-Breadcrumb-list
. The list of all breadcrumb items.ais-Breadcrumb-item
. The breadcrumb navigation item.ais-Breadcrumb-item--selected
. The selected breadcrumb item.ais-Breadcrumb-separator
. The separator of each breadcrumb item.ais-Breadcrumb-link
. The clickable breadcrumb element.
Vue
Customize the UI
default
The slot to override the complete DOM output of the widget.Note that when you implement this slot,
none of the other slots will change the output,
as the default slot surrounds them.Scope
items: object[]
refine: (value: string) => void
createURL: (value: string) => string
object
containing:label
. The label of the category or subcategory.value
. The value of breadcrumb item.
Vue
rootLabel
The slot to override the root label.
Vue
separator
The slot to override the separator.
Vue
HTML output
HTML
If SEO is important for your search page, ensure that your custom HTML is optimized for search engines:
- Use
<a>
tags withhref
attributes to allow search engine bots to follow links. - Use semantic HTML and include structured data when relevant.