Guides
/
Building Search UI
/
UI & UX patterns
Dec. 11, 2020
Sorting Refinements
On this page
Sorting Refinements
With InstantSearch, we make it easy for you to customize the order of your refinement lists. You can sort them in two ways, alphabetically or by occurrence (by refinement count), in ascending or descending order.
Example
Using our RefinementList widgets (RefinementTableWidget
or RefinementCollectionWidget
), you can specify how it is sorted with the sortBy
property like so:
Copy
1
2
3
4
5
6
7
8
9
refinementTableWidget.sortBy = "count:asc"
refinementTableWidget.sortBy = "count:desc"
refinementTableWidget.sortBy = "name:asc"
refinementTableWidget.sortBy = "name:desc"
refinementCollectionWidget.sortBy = "count:asc"
refinementCollectionWidget.sortBy = "count:desc"
refinementCollectionWidget.sortBy = "name:asc"
refinementCollectionWidget.sortBy = "name:desc"