Sort Table
A data table that works on its own: it sorts, searches with highlighted matches, selects rows with a bulk bar, groups, expands rows, pages and hides columns, and it can also report each of those to a server. Rows glide when the order changes.
pixikit.com/docs/app-ui/lists/sort-table
Customize
Caption hidden
Searchable
Selectable
Expandable
Paginate
Page size6
Manual
Density
Striped
Rules
Surface
Sticky header
Height
Column menu
Responsive
Loading
Props
40| Name | Type | Default | Description |
|---|---|---|---|
columns | SortColumn[] | Required | The columns, in order. |
rows | SortRow[] | Required | The records. With `manual`, only the ones on the current page. |
getRowId | (row: SortRow) => string | (row) => String(row.id) | Reads a row's unique id. Default: its `id` key. |
caption | string | None | The table's title, read by screen readers. |
captionHidden | boolean | false | Keeps the caption for screen readers only. |
sort | SortState | None | The sorted column and direction; `null` for none. Makes the sort controlled. |
defaultSort | SortState | None | The sort to start with. |
onSortChange | (sort: SortState) => void | None | Called when a header click changes the sort. |
searchable | boolean | false | Shows a search field that filters the text columns. |
search | string | None | The search text. Makes it controlled. |
onSearchChange | (search: string) => void | None | Called as the search text changes. |
selectable | boolean | false | Adds a checkbox to every row and a select all box to the header. |
selected | string[] | None | The selected row ids. Makes the selection controlled. |
defaultSelected | string[] | None | The ids selected to start with. |
onSelectedChange | (ids: string[]) => void | None | Called with the new ids when the selection changes. |
bulkActions | SortAction[] | [] | Buttons in the bar that slides in when rows are selected. |
onBulkAction | (action: string, ids: string[]) => void | None | Called with the action and the selected ids. |
rowActions | SortAction[] | [] | Items of the menu at the end of every row. |
onRowAction | (action: string, row: SortRow) => void | None | Called with the action and its row. |
groupBy | string | None | The id of a column to group the rows by. Groups can collapse. |
expandable | boolean | false | Lets a row open to show `renderExpanded`. |
renderExpanded | (row: SortRow) => ReactNode | None | The detail shown under an open row. |
paginate | boolean | false | Splits the rows into pages under the table. |
page | number | None | The current page, from 1. Makes it controlled. |
pageSize | number | 10 | Rows per page. |
onPageChange | (page: number) => void | None | Called with the new page. |
manual | boolean | false | Leaves sorting, searching and paging to you: the table only reports them. |
total | number | None | With `manual`, the number of rows in all pages. |
density | "comfortable" | "compact" | "comfortable" | Row height. |
striped | boolean | false | Tints every second row. |
rules | "rows" | "grid" | "none" | "rows" | The lines between cells. |
surface | "plain" | "card" | "card" | `card` frames the table in a bordered card. |
stickyHeader | boolean | false | Keeps the header in view while the rows scroll. Give `height` too. |
height | number | None | The most the table grows before its rows scroll, in px. |
columnMenu | boolean | false | Shows a Columns button that hides and shows columns. |
responsive | "hide" | "stack" | "scroll" | "scroll" | `hide` drops low priority columns, `stack` turns rows into cards, `scroll` scrolls sideways. |
loading | boolean | false | Shows placeholder rows while the data loads. |
empty | ReactNode | None | Shown when there are no rows. |
locale | string | "en-US" | The language numbers, dates and sorting use. |
className | string | None |