Skip to content

API reference ​

The same options apply to the Vue component VTable and to the web component <v-table-system>.

Props ​

Data ​

PropTypeDefaultDescription
dataRow[][]The rows. Every row with clientSide, the current page without it.
columnsColumn[]Column definitions.
labelsstring[]Short form of columns. Ignored when columns is set.
clientSidebooleanfalseThe table searches, sorts and paginates data itself.
loadingbooleanfalseShows a spinner instead of the rows.
rowKeystring | (row) => unknownUnique property of a row, or a function returning a unique value.

Sorting ​

PropTypeDefaultDescription
defaultSort{ key, direction }The sort the table starts with.
sortableColumnsstring[]Keys (or labels, with labels) of sortable columns. Prefer sortable on the column.
PropTypeDefaultDescription
isShowSearchbooleanfalseShows the search box.
showFilterInputsbooleanfalseShows the field dropdown next to the search box.
filtersOptionsstring[][]Options of the dropdown.
searchDebouncenumber1000, or 300 with clientSideMilliseconds to wait after typing.

Pagination ​

PropTypeDefaultDescription
showPaginationbooleantrueShows the pagination bar.
currentPagenumber1The active page. Supports v-model:currentPage.
itemsPerPagenumber1, or 10 with clientSideRows per page. Supports v-model:itemsPerPage.
pageSizeOptionsnumber[]Shows a page size dropdown with these sizes.
totalItemsnumberNumber of rows on the server. Not used with clientSide.
totalPagesnumberOld name of totalItems.

Selection and expansion ​

PropTypeDefaultDescription
selectablebooleanfalseShows the row checkboxes.
selectedRow[][]The selected rows. Supports v-model:selected.
expandablebooleanfalseShows the expand button on every row.
expandRender(row, index) => stringHTML of an expanded row, when the expand slot is not used.

Export ​

PropTypeDefaultDescription
exportablebooleanfalseShows the Export CSV button.
exportFileNamestring"table"File name of the download, without .csv.

Appearance ​

PropTypeDefaultDescription
stripedbooleantrueAlternating row colours.
hoverablebooleantrueHighlights the hovered row.
borderedbooleanfalseBorders around every cell.
densebooleanfalseCompact rows.
stickyHeaderbooleanfalseHeader stays visible while scrolling.
maxHeightstringCSS height of the scrolling area.
rowClassstring | (row, index) => stringClass added to rows.
textsPartial<TableTexts>Replaces the built-in texts.

Events ​

EventPayloadDescription
changePagenumberThe user chose another page.
changeItemsPerPagenumberThe user chose another page size.
Searchstring | SearchPayloadThe search text or the field dropdown changed.
SortBySortPayloadA sort arrow was clicked.
selectRowRowA row was clicked.
selectionChangeRow[]The checkbox selection changed.
expandChange{ row, expanded }A row was opened or closed.
update:currentPage, update:itemsPerPage, update:selectedUsed by v-model.

In the web component the payload is event.detail[0].

Slots ​

Vue component only.

SlotPropsDescription
cell-<key>row, value, index, columnA cell of the column <key>.
header-<key>columnThe header of the column <key>.
expandrow, indexThe details of an expanded row.
toolbarrows, selectedExtra content above the table.
emptyShown when there are no rows.
loadingReplaces the spinner.

Methods ​

Available through a template ref on the Vue component, and directly on the web component.

MethodDescription
exportCsv(fileName?: string)Downloads the rows as a CSV file.
clearSelection()Empties the checkbox selection.

Types ​

All types are exported from v-table-system.

ts
import type { Column, Row, RowAction, SearchPayload, SortPayload, SortState, TableTexts } from "v-table-system";
ts
type Row = Record<string, any>;

type SortDirection = "asc" | "desc";

interface Column {
  key: string;
  label?: string;
  sortable?: boolean;
  width?: string;
  align?: "left" | "center" | "right";
  hidden?: boolean;
  format?: (value: any, row: Row, index: number) => string | number;
  html?: (value: any, row: Row, index: number) => string;
  sort?: (a: Row, b: Row) => number;
  class?: string;
  headerClass?: string;
}

interface RowAction {
  tag: string;
  style?: Record<string, string>;
  callback?: (event: Event, row: Row) => void;
}

interface SortState {
  key: string;
  direction: SortDirection;
}

interface SortPayload extends SortState {
  title: string;
}

interface SearchPayload {
  keySearch: string;
  inputValue: string;
}

interface TableTexts {
  total: string;
  search: string;
  filterPlaceholder: string;
  noData: string;
  rowsPerPage: string;
  exportCsv: string;
  selected: string;
}

Released under the Apache-2.0 License.