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

This widget displays a list of indices, allowing a user to change the way hits are sorting (with replica indices). Another common use case for this widget is to let users switch between different indices. For this widget to work, you must define all indices that you pass down as options as replicas of the main .

Examples

Vue

Props

object[]
required
The list of indices to search in, with each item:
  • label: string. The label of the index to display.
  • value: string. The name of the index to target.
Vue
function
default:"items => items"
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-SortBy. The root of the widget
  • ais-SortBy-select. The select element.
  • ais-SortBy-option. The option element of the select.
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
  • items: object[]. The list of items the widget can display.
  • currentRefinement: string. The currently applied refinement.
  • canRefine: boolean. Whether a refinement can be applied.
  • refine: (value: string) => void. The function to call with the next value of the index name.
Where each item is an object containing:
  • label: string. The label of the index to display.
  • value: string. The name of the index to target.
Vue

HTML output

HTML
Last modified on July 22, 2026