SortOrder
SortOrder renders a list of the possible sort order values, i.e. ascending/descending.
The component is not displayed while executing the search query or if there are no results.
Usage
<SortOrder
values={[{text: "Asc", value: "asc"}, {text: "Desc", value: "desc"}]}
/>
Props
-
values
ArrayA list of possible values, where each value has the format
{ text: "Asc", value: "asc" }.
-
label
functionoptionalAn optional function to wrap the component with a prefix and suffix string.
E.g.label={(cmp) => <> sorted by {cmp}</>}
-
overridableId
StringoptionalAn optional string to define a specific overridable id.
Usage when overriding
const MySortOrder = ({ currentSortOrder, options, onValueChange, ariaLabel, selectOnNavigation }) => {
...
}
const overriddenComponents = {
"SortOrder.element": MySortOrder
};
Parameters
-
currentSortOrder
StringThe current value of the
sortOrderquerystate. -
options
ArrayThe options passed as prop to the component.
-
onValueChange
functionThe function to call when the user changes the sort order field value to change the
querystate.onValueChange(newValue) -
ariaLabel
StringThe ARIA (Accessibility) label to add to the component.
-
selectOnNavigation
BooleanWhen using a dropdown, set if the
onValueChangeshould be called when the new dropdown item is selected with arrow keys, or only on click or on enter.