Base UI (Angular) data-table (Pro) is an ops table: sort, page, select, resize, optional virtualize, and serverSide mode. Cells are row[column.key] — no cell templates. Copy it in, pass columns and data, and handle pageChange when the server owns the slice. Cookbook: invoice-table.
Install with npx base-ui-cli add data-table.
Unlock it plus 89 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
Playground
<base-data-table [columns]="columns" [data]="users" sortable [striped]="true" [bordered]="true" [pageable]="true" [hoverable]="true" [selectable]="false" [resizable]="false"> </base-data-table>
Define [columns] as an array of TableColumn objects and pass [data] as an array of objects.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
Columns support key, label, sortable, width, and align ('left' | 'center' | 'right').
Set [loading]="true" to show skeleton rows while data loads. The data table will render animated placeholder rows matching your column count.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
| 6 | Frank Miller | [email protected] | Viewer | Active | 2024-06-18 |
| 7 | Grace Wilson | [email protected] | Editor | Inactive | 2024-07-22 |
| 8 | Hank Taylor | [email protected] | Viewer | Active | 2024-08-30 |
| 9 | Ivy Anderson | [email protected] | Admin | Active | 2024-09-14 |
| 10 | Jack Thomas | [email protected] | Editor | Inactive | 2024-10-01 |
| 11 | Karen Martinez | [email protected] | Viewer | Active | 2024-11-05 |
| 12 | Leo Garcia | [email protected] | Admin | Active | 2024-12-10 |
Striped rows + Bordered
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
No stripe, no border
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
When data is empty, a friendly message is shown. Customize it with emptyMessage.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| No users found matching your filters. | |||||
Keep the table shell and put the failure in an alert above it. Reuse emptyMessage when the request returned no rows after an error retry.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| No users loaded. | |||||
Set selectable and bind [(selected)] to an array of rowKey values (defaults to id). Header checkbox selects the current page. selectionChange emits the selected row objects.
Selected ids: none
ID | Name | Email | Role | Status | Joined | |
|---|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 | |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 | |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 | |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 | |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
Set resizable and drag the right edge of a header. Lock a column with resizable: false on the column definition. Initial widths come from column.width.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | Alice Johnson | [email protected] | Admin | Active | 2024-01-15 |
| 2 | Bob Smith | [email protected] | Editor | Active | 2024-02-20 |
| 3 | Carol White | [email protected] | Viewer | Inactive | 2024-03-10 |
| 4 | David Brown | [email protected] | Editor | Active | 2024-04-05 |
| 5 | Eve Davis | [email protected] | Admin | Active | 2024-05-12 |
| 6 | Frank Miller | [email protected] | Viewer | Active | 2024-06-18 |
Set serverSide so the table does not slice or sort locally. Pass the current page in data, the full count in totalItems, and reload from pageChange / sortChange.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | User 1 | [email protected] | Admin | Active | 2024-01-15 |
| 2 | User 2 | [email protected] | Editor | Inactive | 2024-02-15 |
| 3 | User 3 | [email protected] | Viewer | Active | 2024-03-15 |
| 4 | User 4 | [email protected] | Admin | Inactive | 2024-04-15 |
| 5 | User 5 | [email protected] | Editor | Active | 2024-05-15 |
| 6 | User 6 | [email protected] | Viewer | Inactive | 2024-06-15 |
| 7 | User 7 | [email protected] | Admin | Active | 2024-07-15 |
| 8 | User 8 | [email protected] | Editor | Inactive | 2024-08-15 |
Set virtualize for large in-memory lists. Rows are windowed inside a fixed-height viewport. Pair with rowHeight matching the rendered row.
ID | Name | Email | Role | Status | Joined |
|---|---|---|---|---|---|
| 1 | User 1 | [email protected] | Admin | Active | 2024-01-15 |
| 2 | User 2 | [email protected] | Editor | Inactive | 2024-02-15 |
| 3 | User 3 | [email protected] | Viewer | Active | 2024-03-15 |
| 4 | User 4 | [email protected] | Admin | Inactive | 2024-04-15 |
| 5 | User 5 | [email protected] | Editor | Active | 2024-05-15 |
| 6 | User 6 | [email protected] | Viewer | Inactive | 2024-06-15 |
| 7 | User 7 | [email protected] | Admin | Active | 2024-07-15 |
| 8 | User 8 | [email protected] | Editor | Inactive | 2024-08-15 |
| 9 | User 9 | [email protected] | Viewer | Active | 2024-09-15 |
| 10 | User 10 | [email protected] | Admin | Inactive | 2024-10-15 |
| 11 | User 11 | [email protected] | Editor | Active | 2024-11-15 |
| 12 | User 12 | [email protected] | Viewer | Inactive | 2024-12-15 |
| 13 | User 13 | [email protected] | Admin | Active | 2024-01-15 |
| 14 | User 14 | [email protected] | Editor | Inactive | 2024-02-15 |
| 15 | User 15 | [email protected] | Viewer | Active | 2024-03-15 |
| 16 | User 16 | [email protected] | Admin | Inactive | 2024-04-15 |
Site-wide VPAT-style notes live on the accessibility report.
Run the following command to add this component to your project:
npx base-ui-cli add data-table
For AI agents
Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.
npx -y base-ui-mcp
Base UI provides standalone components. Import the exact elements you want to use into your component.
// Install: npx base-ui-cli add data-table
// Paths are relative to aliases.components (default: src/app/components)
import { DataTableComponent } from './data-table/data-table.component';
@Component({
selector: 'app-your-component',
imports: [
DataTableComponent
],
template: `...`
})
export class YourComponent {} API for data-table — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
base-data-table | class | string | '' | Extra host classes merged via `cn()`. |
base-data-table | columns | TableColumn[] | [] | Column definitions (`key`, `label`, optional `sortable` / `width` / `align`). |
base-data-table | data | T[] | [] | Row objects. When `serverSide` is set, pass the current page only. |
base-data-table | sortable | boolean | false | Enables header click sorting for columns with `sortable: true`. |
base-data-table | pageable | boolean | false | Shows the paginator when the row count exceeds `pageSize`. |
base-data-table | pageSize | number | 10 | Rows per page (client slice, or the page size advertised to the server). |
base-data-table | loading | boolean | false | Shows skeleton rows instead of data. |
base-data-table | striped | boolean | false | Alternating row background. |
base-data-table | bordered | boolean | false | Outer and row borders. |
base-data-table | hoverable | boolean | true | Row hover highlight. Defaults to true. |
base-data-table | emptyMessage | unknown | 'No data available' | Message shown when `data` is empty and not loading. |
base-data-table | selectable | boolean | false | Adds a checkbox column. Bind `selected` to an array of `rowKey` values. |
base-data-table | rowKey | unknown | 'id' | Property used as the selection identity. Defaults to `'id'`. |
base-data-table | selected | (string | number)[] | [] | Selected row ids (or whatever `rowKey` points at). Two-way bindable. |
base-data-table | resizable | boolean | false | Drag the header edge to resize columns. Uses `column.width` as the start width. |
base-data-table | serverSide | boolean | false | Skip client sort/slice. Parent fetches; pass the current page in `data` and the full count in `totalItems`. |
base-data-table | totalItems | number | 0 | Total rows across all pages. Required for the paginator when `serverSide` is set. |
base-data-table | virtualize | boolean | false | Window rows in a fixed-height viewport. Best with `pageable` off and large `data`. |
base-data-table | rowHeight | number | 44 | Fixed row height in pixels used for windowing. Must match the rendered row. |
base-data-table | viewportHeight | number | 400 | Viewport height in pixels when `virtualize` is set. |
base-data-table | currentPage | number | 1 | Current page (1-based). Two-way bindable for server-driven tables. |
base-data-table | (rowClick) | T | — | Emits the clicked row. Checkbox clicks do not fire this. |
base-data-table | (sortChange) | DataTableSortChange | — | Emits after the user toggles a sortable header. |
base-data-table | (pageChange) | DataTablePageChange | — | Emits when the paginator changes page. Always fired in `serverSide` mode. |
base-data-table | (selectionChange) | T[] | — | Emits the selected row objects whenever the checkbox column changes. |
Content