Skip to main content
Signature

Import

To ensure optimal bundle sizes, see Optimize build size.
Vue

See this widget in action

Preview this widget and its behavior.

About this widget

The ais-toggle-refinement widget provides an on/off filtering feature based on an attribute value.

Examples

Vue

Props

string
required
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
string
required
The label to display for the checkbox.
Vue
string | number | boolean
default:true
The value of the refinement to apply on the attribute when checked.
Vue
string | number | boolean
The value of the refinement to apply on the attribute when unchecked.
Vue
object
default:"{}"
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

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 contains name, count and isRefined.
  • 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 send click events.
    • The view event is automatically sent when the facets are rendered.
    • The click event is automatically sent when refine is called.
    To learn more, see the insights middleware.
Vue

HTML output

HTML
Last modified on July 22, 2026