Signature
Import
- Component
- Plugin
To ensure optimal bundle sizes,
see Optimize build size.
Vue
About this widget
Theais-current-refinements
widget displays a list of refinements applied to the search.
Examples
Vue
Props
The attributes to include in the widget (all by default).
Can’t be used with
excluded-attributes
.
In the example below, only the categories
attribute is included in the widget.Vue
The attributes to exclude from the widget.
Can’t be used with
included-attributes
.
In the example below, the brand
attribute is excluded from the widget.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
.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 CSS classes you can override:
ais-CurrentRefinements
. The root element of the widget.ais-CurrentRefinements--noRefinement
. The root element of the widget without refinement.ais-CurrentRefinements-list
. The list of refined items.ais-CurrentRefinements-item
. The item of the refined items list.ais-CurrentRefinements-label
. The label of the refined item.ais-CurrentRefinements-delete
. The delete button of each item.
Vue
Customize the UI
default
The slot to override the complete DOM output of the widget.When you implement this slot,
none of the other slots will change the output,
as the default slot surrounds them.Scope
items: object[]
. The refinements currently applied to the search.createURL: (value: object) => string
. The function to return a link for the search without this refinement.
object
containing:indexName: string
. The index name on which the refinement is applied.indexId: string
. The index id on which the refinement is applied.attribute: string
. The name of the attribute with which the refinement is applied. The value is used as the key.label: string
. The name of the attribute with which the refinement is applied. The label is used as the the display value.refine: (value: object) => void
. The function to clear a refinement.refinements: object[]
. Each of the individual refinements for this attribute.
object
containing:type: string
. Can be"facet"
,"exclude"
,"disjunctive"
,"hierarchical"
,"numeric"
or"query"
.attribute: string
. The name of the attribute where the refinement is applied. The value is used as the key.label: string
. The name of the attribute with which the refinement is applied. The label is used as the the display value.value: any
. Actual value for this refinement.
Vue
item
The slot to override the DOM output of an item.Scope
item: object
. One attribute with refinements.refine: (value: string) => void
. The function to clear a refinement.createURL: (value: string) => void
. The function to return a link for the search without this refinement.
object
containing:indexName: string
. The index name on which the refinement is applied.indexId: string
. The index id on which the refinement is applied.attribute: string
. The name of the attribute with which the refinement is applied. The value is used as the key.label: string
. The name of the attribute with which the refinement is applied. The label is used as the the display value.refine: (value: object) => void
. The function to clear a refinement.refinements: object[]
each of the individual refinements for this attribute.
object
containing:type: string
. Can be"facet"
,"exclude"
,"disjunctive"
,"hierarchical"
,"numeric"
or"query"
.attribute: string
. The name of the attribute with which the refinement is applied. The value is used as the key.label: string
. The name of the attribute with which the refinement is applied. The label is used as the the display value.value: any
. The actual value for this refinement.
Vue
refinement
The slot to override the DOM output of a sinrefinement.Scope
refinement: object
. One item of the list of refinements.refine: (value: string) => void
. The function to clear a refinement.createURL: (value: string) => void
. The function to return a link for the search without this refinement.
object
containing:type: string
. Can be"facet"
,"exclude"
,"disjunctive"
,"hierarchical"
,"numeric"
or"query"
.attribute: string
. The name of the attribute where the refinement is applied. The value is used as the key.label: string
. The name of the attribute with which the refinement is applied. The label is used as the the display value.value: any
. The actual value for this refinement.
Vue
HTML output
HTML