Signature
Import
- Component
- Plugin
To ensure optimal bundle sizes,
see Optimize build size.
Vue
About this widget
Theais-toggle-refinement
widget provides an on/off filtering feature based on an attribute value.
Examples
Vue
Props
The name of the attribute on which to apply the refinement.To avoid unexpected behavior, you can’t use the same
attribute
prop in a different type of widget.Vue
The label to display for the checkbox.
Vue
The value of the refinement to apply on the attribute when checked.
Vue
The value of the refinement to apply on the attribute when unchecked.
Vue
The CSS classes you can override:
ais-ToggleRefinement
. The root of the widget.ais-ToggleRefinement--noRefinement
. The root of the widget without refinement.ais-ToggleRefinement-label
. The label of the toggle.ais-ToggleRefinement-checkbox
. The checkbox element of the toggle.ais-ToggleRefinement-labelText
. The label text of the toggle.ais-ToggleRefinement-count
. The count of the toggle.
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
-
value: object
. The current refinement. It containsname
,count
andisRefined
. -
canRefine: boolean
. Whether the refinement can be applied. -
refine: (value: string) => void
. The function to call with the provided value to update the refinement. -
createURL: (value: string) => void
. The function to generate a link from the provided value. -
sendEvent: (eventType: 'click', facetValue: string) => void
. The function to sendclick
events.- The
view
event is automatically sent when the facets are rendered. - The
click
event is automatically sent whenrefine
is called.
insights
middleware. - The
Vue
HTML output
HTML