Table
A dense data table defined by column templates, with captions and an empty state.
Available in
Angular: available Vue: available React: available React Native: not available yet
Usage
| Title | Folder | Last modified | Actions |
|---|---|---|---|
| Q4 planning — decisions and owners | Product | Sep 24 | |
| Hiring loop debrief | People | Sep 22 | |
| Research synthesis: onboarding interviews | Research | Sep 19 | |
| Vendor call — licensing terms | Legal | Sep 12 |
<sone-table
[rows]="notes()"
[trackBy]="byId"
[isSelected]="isSelected"
caption="Notes modified in the last 30 days."
emptyText="No notes left. Every row went to the trash."
>
<sone-table-column key="title" header="Title">
<ng-template let-row>{{ row.title }}</ng-template>
</sone-table-column>
<sone-table-column key="folder" header="Folder" width="140px">
<ng-template let-row><span soneBadge variant="outline">{{ row.folder }}</span></ng-template>
</sone-table-column>
<sone-table-column key="modified" header="Last modified" width="140px" [alignEnd]="true">
<ng-template let-row>{{ row.modified }}</ng-template>
</sone-table-column>
<sone-table-column key="actions" header="Actions" width="48px" [hideHeader]="true">
<ng-template let-row>
<sone-row-menu [label]="'Actions for ' + row.title">
<button soneMenuItem type="button" role="menuitem" (click)="selectedId.set(row.id)">Select</button>
<button soneMenuItem variant="destructive" type="button" role="menuitem" (click)="remove(row.id)">
Move to trash
</button>
</sone-row-menu>
</ng-template>
</sone-table-column>
</sone-table>Import
import {
SoneTableColumnComponent,
SoneTableComponent,
} from "@surface-one/angular/table";API reference
SoneTableColumnComponentComponent
| Name | Type | Default |
|---|---|---|
keyrequired | string | — |
header | string | "" |
hideHeader | boolean | false |
width | string | null | null |
alignEnd | boolean | false |
sortThe header's `aria-sort`; set it on the sorted column only. | "ascending" | "descending" | "none" | null | null |
SoneTableComponentComponent
| Name | Type | Default |
|---|---|---|
rowsrequired | readonly T[] | — |
trackByrequired | (row: T) => unknown | — |
rowClass | (row: T) => Record<string, boolean> | () => ({}) |
isSelected | (row: T) => boolean | () => false |
caption | string | null | null |
emptyText | string | null | null |
columnsThe columns as data (`{ key, header, cell }`), like the Vue and React twins — an alternative to `<sone-table-column>` children, which win when both are given. | readonly SoneTableColumn<T>[] | null | null |