Android
Signature
Explore example code
Browse the Hierarchical Menu example code on GitHub.
About this widget
AHierarchical Menu is a component that displays a hierarchical navigation menu, based on facet attributes.
Examples
Kotlin
Low-level API
If you want to fully control the Hierarchical Menu components and connect them manually, use the following components:Searcher. TheSearcherthat handles your searches.FilterState. The current state of the filters.HierarchicalViewModel. The logic applied to the hierarchical facets.HierarchicalView. The concrete hierarchical view.HierarchicalPresenter. The presenter that controls the sorting and other settings of the hierarchical menu.HierarchicalItem. A single node in the hierarchy.
Kotlin
Compose UI
InstantSearch providesHierarchicalState as a state model,
which implements the HierarchicalView interface.
You need to connect HierarchicalState to the HierarchicalConnector or HierarchicalViewModel like any other HierarchicalView implementation.
Kotlin
Parameters
The attribute to filter.
The
FilterState that holds your filters.The names of the hierarchical attributes that you need to target, in ascending order.
The delimiter used to separate hierarchical facets.
Usually something like ” > ”, including spaces as shown in this example.
View
The view that renders the hierarchical menu.
How to display the list of
HierarchicalItem.
Takes a list of HierarchicalItem and returns a new list of HierarchicalItem.
A HierarchicalItem contains a Facet, its level, and a displayName.Kotlin