Table
Compare data in rows and columns with sorting, filtering, and selection.
Usage guide
#Use for browsing, sorting, and selecting lightweight lists. Use Grid when large datasets require virtualization.
Connect columns and data
Pass
keyandlabelincolumns, and a JavaScript array inrows.Set row identifiers
Set
rowKeyto a stable, unique key.Enable the interactions you need
Choose per-column
sortableandfilterable, setselectionModetonone,single, ormultiple, and connect events to app state.
Examples
#Feature examples
#Choose a feature from 34 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.
No matching features.
API reference
#Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.
<sy-table>
Properties
| Attribute / Property | Type | Default | Description |
|---|---|---|---|
SyTableColumn[] | string | [] | Array of column definitions with key, label, sortable, filterable, and other properties. Pass objects and arrays as JavaScript properties. | |
SyTableRow[] | string | [] | Array of row data. Each row must have a unique key. Pass objects and arrays as JavaScript properties. | |
SyTableRow[] | string | '' | Alias of `rows`; takes precedence when set so consumers can bind data without choosing a name. Pass objects and arrays as JavaScript properties. | |
string | 'id' | Field name used to identify a row uniquely. Spec name: `row-key`. | |
'none' | 'single' | 'multiple' | 'none' | Selection mode. Spec name: `selection-mode`. | |
'none' | 'horizontal' | 'vertical' | 'full' | 'outline' | 'horizontal' | Display style for row, column, and outer borders. | |
'solid' | 'dashed' | 'dotted' | 'solid' | Border line style for every divider in the table — outer frame, column dividers (`variant: 'vertical' | 'full'`), and row dividers (`variant: 'horizontal' | 'full'`). Width and colour stay on the design-system tokens; only the dash pattern changes. Spec name: `line-style`. | |
boolean | false | Alternate row background colour. | |
boolean | false | Reduce row height. | |
boolean | true | Pin the header inside the scroll container. Spec name: `sticky-header`. | |
boolean | false | Hide the column header (`<thead>`). Use when the table has columns but the visual design omits the header — e.g. the row-header pattern where the leftmost column already identifies each row, or when the header lives outside the table. Spec name: `hide-header`. | |
boolean | false | Render the first data column as a row header (`<th scope="row">`). Useful for grids where the leftmost column identifies the row (think spreadsheet row labels). Spec name: `row-header`. | |
boolean | true | Pin the row header to the left edge while the body scrolls horizontally. Has no effect unless `row-header` is also set. Spec name: `sticky-row-header`. | |
string | 'No data' | Empty-state text when no rows are present. Spec name: `empty-text`. | |
string | '' | Currently sorted column key. Spec name: `sort-key`. | |
SyTableSortDirection | 'none' | Active sort direction. Spec name: `sort-direction`. | |
string[] | string | [] | Array of currently selected row keys. Pass objects and arrays as JavaScript properties. | |
boolean | false | Indicate that processing is in progress. | |
string | '' | Optional accessible label applied to the `<table>` element. | |
boolean | false | Allow the user to drag a column's right edge to resize it. The new width is committed on pointer-up and a `columnResized` event fires. Resize state is keyed by `column.key` so initial `column.width` and explicit changes coexist. Drag handles appear on every cell (header + body) so the user can grab the column edge from any row. |
Events
| Event | Detail | Description |
|---|---|---|
CustomEvent<{ key: string; direction: SyTableSortDirection }> | Read the result from the event's detail. | |
CustomEvent<{ selectedKeys: string[]; selectedRows: SyTableRow[] }> | Read the result from the event's detail. | |
CustomEvent<{ row: SyTableRow; index: number; key: string; originalEvent: MouseEvent | KeyboardEvent }> | Read the result from the event's detail. | |
CustomEvent<{ key: string; value: string; filters: Record<string, string> }> | Fires after a column filter is applied or cleared. `value` is the committed text (empty string = filter cleared); `filters` is a snapshot of every active filter so consumers can serialize the entire filter set. | |
CustomEvent<{ key: string; width: number; widths: Record<string, number> }> | Fires when a resize gesture commits the new width on pointer-up. |
Methods
| Method | Returns | Description |
|---|---|---|
Promise<SyTableRow[]> | Return an array of selected row data. | |
Promise<void> | Deselect all rows. | |
Promise<void> | Select the row with the specified key. | |
Promise<void> | Set a column's sort direction. | |
Promise<void> | Toggle the loading indicator. | |
Promise<void> | Scroll the table to the top. | |
Promise<void> | Programmatically set or clear a column filter. Pass an empty string to clear. Bypasses the popover UI so consumers can drive filters from external controls (saved views, query string, etc.). Fires `filterChanged`. | |
Promise<Record<string, string>> | Returns a snapshot of every active filter keyed by column key. | |
Promise<void> | Clears every active filter at once. Fires `filterChanged` with `key: ''`. | |
Promise<void> | Programmatically set the rendered width (in pixels) of a column. Pass `0` to revert to the column's intrinsic width. |
Slots
| Slot | Description |
|---|---|
| Component body or child items. |