The Base UI (Angular) table is a free set of directives on native HTML table parts: caption, thead, tbody, tfoot, tr, th, and td. Copy it in with the CLI and compose a static or lightly interactive grid. For sort, page, select, resize, or serverSide, use Pro data-table.
Install with npx base-ui-cli add table.
Directives attach to native <table> parts so the browser table model stays intact. Wrap the table in an overflow container when the grid is wider than the page. For sort, page, select, or resize, use data-table (Pro).
| Invoice | Status | Method | Amount |
|---|---|---|---|
| INV-001 | Paid | Card | $250.00 |
| INV-002 | Pending | PayPal | $150.00 |
| INV-003 | Unpaid | Bank transfer | $350.00 |
| Total | $750.00 | ||
<div class="relative w-full overflow-auto">
<table base-table>
<caption base-table-caption>A list of recent invoices.</caption>
<thead base-table-header>
<tr base-table-row>
<th base-table-head>Invoice</th>
<th base-table-head>Status</th>
<th base-table-head class="text-right">Amount</th>
</tr>
</thead>
<tbody base-table-body>
<tr base-table-row>
<td base-table-cell>INV-001</td>
<td base-table-cell>Paid</td>
<td base-table-cell class="text-right">$250.00</td>
</tr>
</tbody>
</table>
</div>
TypeScript
import { Component } from '@angular/core';
// Install: npx base-ui-cli add table
// Paths are relative to aliases.components (default: src/app/components)
import { TableBodyDirective, TableCaptionDirective, TableDirective, TableFooterDirective, TableHeadDirective, TableHeaderDirective, TableRowDirective, TableTdDirective } from './table/table.directives';
@Component({
selector: 'app-table-example',
imports: [
TableBodyDirective,
TableCaptionDirective,
TableDirective,
TableFooterDirective,
TableHeadDirective,
TableHeaderDirective,
TableRowDirective,
TableTdDirective
],
template: `...`
})
export class TableExampleComponent {}Install
npx base-ui-cli add table
Run the following command to add this component to your project:
npx base-ui-cli add 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 table
// Paths are relative to aliases.components (default: src/app/components)
import { TableBodyDirective, TableCaptionDirective, TableDirective, TableFooterDirective, TableHeadDirective, TableHeaderDirective, TableRowDirective, TableTdDirective } from './table/table.directives';
@Component({
selector: 'app-your-component',
imports: [
TableBodyDirective,
TableCaptionDirective,
TableDirective,
TableFooterDirective,
TableHeadDirective,
TableHeaderDirective,
TableRowDirective,
TableTdDirective
],
template: `...`
})
export class YourComponent {} API for table — generated from JSDoc in the library source.
| API | Member | Type | Default | Description |
|---|---|---|---|---|
caption[base-table-caption] | — | — | — | Native `<caption>` for . |
caption[base-table-caption] | class | string | '' | Extra classes merged via `cn()`. |
table[base-table] | — | — | — | Styled native `<table>`. Compose with `base-table-header`, `base-table-body`, `base-table-row`, `base-table-head`, `base-table-cell`, and `base-table-caption`. For sort, page, select, or resize, use Pro `data-table`. |
table[base-table] | class | string | '' | Extra classes merged via `cn()`. |
tbody[base-table-body] | — | — | — | Native `<tbody>` for . |
tbody[base-table-body] | class | string | '' | Extra classes merged via `cn()`. |
td[base-table-cell] | — | — | — | Native `<td>` for . Not the Pro data-table cell template (`baseTableCell`). |
td[base-table-cell] | class | string | '' | Extra classes merged via `cn()`. |
tfoot[base-table-footer] | — | — | — | Native `<tfoot>` for . |
tfoot[base-table-footer] | class | string | '' | Extra classes merged via `cn()`. |
th[base-table-head] | — | — | — | Native `<th>` for . |
th[base-table-head] | class | string | '' | Extra classes merged via `cn()`. |
thead[base-table-header] | — | — | — | Native `<thead>` for . |
thead[base-table-header] | class | string | '' | Extra classes merged via `cn()`. |
tr[base-table-row] | — | — | — | Native `<tr>` for . |
tr[base-table-row] | class | string | '' | Extra classes merged via `cn()`. |
Content