Skip to content

Sorting

QTableSorting edits an ordered v-model:sorting list. It owns only the user interaction; the consuming application turns the emitted { id, desc } entries into an API query or table sort.

Empty sorting popover

Configured sorting popover

Inputs and state

Prop/modelDefaultDescription
v-model:sortingrequiredOrdered SortingState: { id: string, desc: boolean }[].
fieldsrequiredAvailable { value, label, disabled? } fields.
iconi-tabler-arrows-sortTrigger icon.
shortcutstrueEnables Shift + S.
textsExplicit text overrides, ahead of i18n and English defaults.
ui.contentExtra classes for the Nuxt UI popover content.

Disabled fields and fields already in sorting are not offered by the default add selector. The trigger changes to the primary color when at least one sort is active.

Popover actions

  • Add sort — select one of the remaining fields and press the plus button. The component appends it with desc: false.
  • Change direction — press the direction button on an existing entry to toggle its desc value.
  • Remove sort — press the remove button on an entry.
  • Clear sorting — press the header action to emit an empty list.
  • Use a custom order editor — the items slot receives move(from, to) for an application-defined order UI.
vue
<QTableSorting v-model:sorting="sorting" :fields="sortableFields" />

Slots

SlotUseful slot props
triggeropen, toggle, active
headersorting, clear
itemssorting, remove, toggleDirection, move
itemsort, index, remove, toggleDirection
addavailableFields, add

Use a slot when the default region needs to be replaced, not merely renamed. Use texts for labels and accessible names.

Released under the MIT License.