For a plain list of similar items without columns, use CdsList; for a hierarchy without tabular data, use CdsTree.
The table's features are split across sections — they are collected in Documentation sections and in the menu on the left. This page covers the basics and the API.
Anatomy
Around the table there are the header, toolbar and footer slots and built-in pagination (the pagination prop). The table itself consists of a column header and rows with cells.
Variations
Showing data
A minimal table: an array of column descriptions in columns, the records in data. The row key comes from the record's key field or from the row-key prop.
The column's align property aligns the content — numeric values are conventionally aligned to the right.
Sizes
The size prop controls the density: md is the default, sm and xs are for data-dense screens.
Rows
The row-class-name property computes a row class from the record: the built-in cds-table--striped class alternates the background, cds-table__row--warning and cds-table__row--error add a status highlight. The hovered prop highlights the row under the cursor.
Cell content
The column's ellipsis property truncates long text to a single line with an ellipsis — in cells and in headers alike.
Responsiveness
The column's responsive property lists the breakpoints at which the column is visible — secondary columns get hidden on narrow screens.
Guidelines
Documentation sections
- Structure and headers — header grouping, merged cells, the slots around the table, column widths and declarative column descriptions.
- Pinning and scrolling — pinning the header and columns while scrolling, horizontal scroll buttons.
- Filters and sorting — column filters, multiple sorting, resetting and a custom filter panel.
- Row selection — checkboxes, operations on the selected set, custom selection menu items.
- Expansion and trees — expandable rows, nested tables and tree data.
- Editing — editable cells, rows and the whole table.
- Drag and drop — dragging rows and columns.
- Scenarios — server-side data and ready-made recipes for product tables.
API
CdsTable
Props
| Name | Type | Default | Description |
|---|---|---|---|
bordered | boolean | undefined | false | Show every table border |
borderless | boolean | undefined | false | Remove every table border |
canExpandable | boolean | undefined | false | Rows can be expanded |
childrenColumnName | string | undefined | 'children' | Name of the property holding the child records |
columnDraggable | NTable.NDraggable.TColumnDraggable<any> | undefined | — | Column drag and drop. true or a configuration object
{ icon, disabled, allowDrop }. Reordering only happens among siblings
inside the same group; the consumer changes the order in the @column-reorder handler. |
columns | NTable.NColumn.TColumns<any> | undefined | — | Table columns |
components | NTable.NCustomize.TableComponents<any> | undefined | — | Override the default table components |
customHeaderRow | NTable.NCustomize.TGetComponentProps<NTable.NColumn.IColumn<any>[]> | undefined | — | Sets the properties for every header row |
customRow | NTable.NCustomize.TGetComponentProps<any> | undefined | — | Sets the properties for every row |
data | any[] | undefined | — | Array of records to show in the table |
defaultExpandAllRows | boolean | undefined | false | All rows are expanded by default |
defaultExpandedRowKeys | NTable.TKey[] | undefined | undefined as ITableProps['defaultExpandedRowKeys'] | Keys of the rows expanded by default |
disabled | boolean | null | undefined | null | Disabled state |
expandColumnWidth | number | undefined | — | Width of the expand column |
expandedRowClassName | NTable.NRow.TClassName<any> | undefined | — | Classes for rows in the expanded state |
expandedRowKeys | NTable.TKey[] | undefined | undefined as ITableProps['expandedRowKeys'] | Keys of the currently expanded rows (supports v-model) |
expandedRowRender | NTable.NExpand.TExpandedRowRender<any> | undefined | — | Render function for every expanded row |
expandFixed | NTable.TFixed | undefined | — | Pin the expand column (left | right | boolean) |
expandIcon | NTable.NExpand.TRenderExpandIcon<any> | undefined | — | Custom expand icon |
expandIconColumnIndex | number | undefined | — | Index of the column that holds the expand icon |
expandRowByClick | boolean | undefined | false | Expand the row by clicking anywhere in it |
footer | NTable.NRender.TPanelRender<any> | undefined | — | Render function for the table footer |
getPopupContainer | NTable.NCustomize.TGetPopupContainer | undefined | — | Container that dropdowns are rendered into |
header | NTable.NRender.TPanelRender<any> | undefined | — | Render function for the table title |
hovered | boolean | undefined | false | Highlight the row on hover |
id | string | undefined | — | Table identifier |
indentSize | number | undefined | 20 | Indent size in pixels for each nesting level |
loading | boolean | undefined | false | Table loading state |
locale | NTable.ILocale | undefined | — | Table localization (overrides the strings of the global locale) |
pagination | false | NTable.NPagination.IProps | undefined | — | Table pagination configuration |
readonly | boolean | null | undefined | null | Read-only state |
rowClassName | string | NTable.NRow.TClassName<any> | undefined | — | Row classes |
rowDraggable | NTable.NDraggable.TRowDraggable<any> | undefined | — | Row drag and drop. true or a configuration object
{ icon, disabled, allowDrop }. Reordering only happens between siblings
of the same parent; the consumer changes the order in the @row-reorder handler. |
rowExpandable | ((record: any) => boolean) | undefined | — | Whether the row can be expanded |
rowKey | string | NTable.NRow.TGetRowKey<any> | undefined | 'key' | Unique row key — a string or a function returning a string |
rowSelection | NTable.NRow.IRowSelection<any> | undefined | — | Row selection configuration |
scroll | (NTable.TScroll & { scrollToFirstRowOnChange?: boolean | undefined; }) | undefined | — | Whether the table can be scrolled |
showExpandColumn | boolean | undefined | — | Show the expand column |
showHeader | boolean | undefined | — | Whether to show the table header |
showSorterTooltip | NTable.NSorter.TTooltip | undefined | true | Whether to show sorting tooltips in the header. You can pass an object with CdsTooltip properties. |
size | number | "xs" | "sm" | "md" | "lg" | "xl" | undefined | 'md' | Size of the component |
sortDirection | string[] | undefined | — | Sorting of the table data. 'ascend' | 'descend' |
sticky | boolean | NTable.NSticky.ISticky | undefined | — | Sticky behavior for the header and the scrollbar |
tableLayout | NTable.TLayout | undefined | — | Fixed or auto layout |
theme | string | undefined | — | Component theme |
toolbar | NTable.NRender.TPanelRender<any> | undefined | — | Render function for the table toolbar |
transformCellText | NTable.NCell.TTransformCellText<any> | undefined | — | Transform the text inside a cell |
Events
| Name | Type | Description |
|---|---|---|
change | [pagination: NTable.NPagination.IProps, filters: Record<string, NTable.TFilterValue | null>, sorter: NTable.ISorterResult<any> | NTable.ISorterResult<any>[], extra: NTable.ICurrentData<any>] | Fired when the pagination, the filters or the sorting change. |
columnReorder | [info: NTable.NDraggable.IColumnReorderInfo<any>] | Fired when a column is dragged. The consumer changes the order of the columns. |
expand | [expanded: boolean, record: any] | Fired when a row is expanded or collapsed. |
expandedRowsChange | [expandedKeys: NTable.TKey[]] | Fired when the set of expanded rows changes. |
resizeColumn | [width: number, column: NTable.NColumn.IColumn<any>] | Fired when a column is resized. |
rowReorder | [info: NTable.NDraggable.IRowReorderInfo<any>] | Fired when a row is dragged. The consumer changes the order of the data. |
update:expandedRowKeys | [expandedKeys: NTable.TKey[]] | Fired when the expanded rows are updated (v-model). |
Slots
| Name | Type | Description |
|---|---|---|
bodyCell | { text: any; value: any; record: any; index: number; column: NTable.NColumn.IColumn<any>; } | Custom render of a table body cell. |
customFilterDropdown | NTable.NColumn.IFilterDropdownProps<any> | Custom filter dropdown of a column (used together with the column customFilterDropdown). |
customFilterIcon | { filtered: boolean; column: NTable.NColumn.IColumn<any>; } | Custom column filter icon. |
default | any | Declarative column description with CdsTableColumn / CdsTableColumnGroup. |
emptyText | any | Content shown when there is no data. |
expandedRowRender | { record: any; index: number; indent: number; expanded: boolean; } | Render of the expanded row content. |
expandIcon | NTable.NExpand.IRenderExpandIconProps<any> | Custom row expand icon. |
footer | readonly any[] | Table footer (the panel below the table). |
header | readonly any[] | Table title (the panel above the table). |
headerCell | { title: NTable.NColumn.TTitle<any>; column: NTable.NColumn.IColumn<any>; } | Custom render of a table header cell. |
summary | { pageData: readonly any[]; } | Summary row of the table. |
toolbar | readonly any[] | Table toolbar (the panel above the table). |
Exposed
| Name | Type | Description |
|---|---|---|
table | any | Reference to the internal table instance — gives access to its methods and state. |
CdsTableColumn
Slots
| Name | Type | Description |
|---|---|---|
default | { value: any; text: any; record: any; index?: number | undefined; renderIndex?: number | undefined; column: NTable.NColumn.IColumn<any>; } | Custom render of a column cell. |
filterIcon | { filtered: boolean; column: NTable.NColumn.IColumn<any>; } | Custom column filter icon. |
title | NTable.NColumn.ITitleProps<any> | Column title. |
CdsTableColumnGroup
Slots
| Name | Type | Description |
|---|---|---|
default | any | Columns of the group (CdsTableColumn). |
title | NTable.NColumn.ITitleProps<any> | Title of the column group. |