Signature
Import
- Component
- Plugin
To ensure optimal bundle sizes,
see Optimize build size.
Vue
About this widget
Useais-trending-facets to display facet values identified by the trending facet values model,
such as brands whose products are gaining popularity.
See also: Set up Algolia Recommend
Examples
Vue
Props
string
required
The attribute for which to retrieve trending values, such as
brand.
The attribute must be included in the trending facet values model.Vue
number
The maximum number of trending facet values to retrieve.
The widget may return fewer values, depending on the available recommendations and request parameters.
If you omit
limit or set it to 0,
the widget returns all available trending facet values.Vue
number
The recommendation score threshold (0 to 100).
The widget only returns facet values with a score greater than this threshold.
Vue
Omit<SearchParameters, hitsPerPage | length | offset | page>
List of search parameters
to send as an extra set when there aren’t enough recommendations.
Vue
boolean
default:true
Whether to escape HTML tags from recommendations string values.
Vue
function
default:"items => items"
A function to transform or reorder recommendations before the widget displays them.
It returns an array of items with the same structure.
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
object
default:"{}"
The CSS classes you can override:
ais-TrendingFacets. The widget’s root element.ais-TrendingFacets--empty. The root element without results.ais-TrendingFacets-title. The widget’s title element.ais-TrendingFacets-container. The container of the list element.ais-TrendingFacets-list. The list of trending facet values.ais-TrendingFacets-item. The list item.
Vue
Customize the UI
The slot to override the complete DOM output of the widget.
The widget only uses this slot if you don’t provide any other slot.Scope
items: object[]. The trending facet values. Each item hasfacetName,facetValue, and_scoreproperties.
Vue
The slot to override the DOM output of each trending facet value.
If you don’t provide it, the widget displays the
facetValue as plain text.Scopeitem: object. A single trending facet value withfacetName,facetValue, and_scoreproperties.
Vue
The slot to override the DOM output of the title header.
The widget doesn’t render the header when there are no recommendations.
If you don’t provide it, the widget displays “Trending” as the title.Scope
items: object[]. The trending facet values.translations: object. The widget’s translations, such astitle.classNames: object. The widget’s CSS classes, such astitle.
Vue
The slot to override the DOM output when there are no trending facet values.
If you don’t provide it, the widget displays “No results”.
Vue
HTML output
HTML