Signature
Explore example code
Browse the RefinementList example code on GitHub.
About this widget
RefinementList is a filtering view that displays facets
and lets users refine their search results by filtering on specific values.
Requirements
Theattribute provided to the widget must be in attributes for faceting,
either on the dashboard or using the attributesForFaceting parameter with the API.
Examples
Kotlin
Low-level API
If you want to fully control theRefinementList components and connect them manually, use the following components:
FilterState. The current state of the filters.FacetListViewModel. The logic applied to the facets.FacetListView. The view that renders facets.FacetListPresenter. Optional. The presenter that controls the sorting and other settings of the facet list view.
Kotlin
Compose UI
InstantSearch provides theFacetListState as a state model,
which is an implementation of the FacetListView interface.
You need to connect FacetListState to the FacetListConnector or FacetListViewModel like any other FacetListView implementation.
Kotlin
Parameters
FilterState
required
The
FilterState that holds your filters.String
required
The attribute to filter.
SelectionMode
default: Multiple
Whether the list can have
Single or Multiple selections.List<FacetHits>
default: listOf()
If specified, the default facet values to display.
Boolean
default:false
When true, the selection will be kept even if it does not match current results anymore.
FilterGroupID
default: FilterGroupID(attribute, FilterOperator.Or)
Filters operator, which can either be
FilterOperator.And or FilterOperator.Or.Use filters or facet filters for more complex result refinement.View
FacetListView
required
The view that renders the facets.
FacetListPresenter
default:"null"
The presenter that controls the sorting and other settings of the facet list view.
Kotlin
Presenter
List<FacetSortCriterion>
default:"listOf(FacetSortCriterion.CountDescending)"
How to sort facets. Must be one or more of the following values:
FacetSortCriterion.IsRefinedFacetSortCriterion.CountAscendingFacetSortCriterion.CountDescendingFacetSortCriterion.AlphabeticalAscendingFacetSortCriterion.AlphabeticalDescending
Kotlin
Int
default:10
The number of facet values to retrieve.
Kotlin