Skip to main content
Signature

Explore example code

Browse the Filter Toggle example code on GitHub.

About this widget

Filter Toggle is a filtering view that displays any kind of filter, and lets users refine the search results by toggling it on or off.

Examples

Kotlin

Low-level API

If you want to fully control the Filter Toggle components and connect them manually, use the following components:
  • Searcher. The Searcher that handles your searches.
  • FilterState. The current state of the filters.
  • FilterToggleViewModel. The logic applied to the filter.
  • FilterToggleView. The view that renders the filter toggle.
  • FilterPresenter. Optional. The presenter to customize the display of the filters.
Kotlin

Compose UI

InstantSearch provides the FilterToggleState as a state model, which is an implementation of the FilterToggleView interface. You need to connect FilterToggleState to the FilterToggleConnector or FilterToggleViewModel like any other FilterToggleView implementation.
Kotlin

Parameters

FilterState
required
The FilterState that will hold your filters.
Filter
required
The filter to apply.
Boolean
If true, the filter is active when created.
FilterGroupID
default: FilterGroupID(filter.attribute, FilterOperator.And)
When specified, the filter is grouped under this ID and composed with this operator. Defaults to the used attribute, applying FilterOperator.And with any other filters of this group.

View

FilterToggleView
required
The view that renders the filter toggle.
FilterPresenter
default:"FilterPresenterImpl()"
A presenter describing how to display a filter.
Kotlin
Last modified on July 22, 2026