Skip to main content

Single Sort

Usage​

The single level sort allows a user to sort data in a responsive table by one criterion at a time in any breakpoint.

Common Characteristics​

The single level sort consists of a “sort by” label and an action link displaying the currently selected sort criterion. Clicking or tapping the action link opens a panel of sort criteria, each with a pair of buttons for sorting high-to-low or low-to-high.

  • “↑” sorts low-to-high (#-###,###) / last-to-first (Z-A)
  • “↓” sorts high-to-low (###,###-#) / first-to-last (A-Z)

The single level sort should be paired with the Basic Responsive Table. Sort criteria is determined by the needs of each use case.

Code​

Default Single Sort​

Live Editor
Result
Loading...

Props​

Single Sort​

NameTypeDefaultDescription
sortFieldsarray[]Array of available sortField objects (See below).
activeSortFieldobjectnullsortField object representing current search criteria
dataRowsarray[]Array of components to sort base on sort vale. Components can either have simple string value or must define a sortvalue attribute.
sortedCallbackfunctionnullCallback called after data is resorted, receives array of sorted data.
sortOrderstring"ASC"String defining current sort direction. ASC or DESC

sortField Object​

NameTypeDefaultDescription
labelstring""Label for search option
sortvaluestring"" (optional)Optional sortable value.
indexnumberundefinedUnique Integer used to match sortFields object with activeSortField
sorttypestring"alpha"Type of sort. alpha or number