jatui

SortDropdown

Sort-by column dropdown with direction toggle and optional filter input

Demo

Sorting by created_at desc

With filter input

Props

PropTypeDefaultDescription
optionsSortOption[]-Available sort columns (required)
sortBystring-Current sort key
sortDir"asc" | "desc"-Current sort direction
showFilterbooleanfalseShow a search input in the dropdown
filterValuestring""Current filter text
filterPlaceholderstring"Filter…"Filter input placeholder
size"xs" | "sm" | "md""xs"Button size
onSortChange(value, dir) => void-Called when sort changes
onFilterChange(value) => void-Called when filter text changes

SortOption type

interface SortOption {
  value: string;
  label: string;
  icon: string;          // emoji or icon character shown in trigger
  defaultDir?: 'asc' | 'desc';  // default direction when first selected
}