Table
A table of data: the native table elements, in the look of the app's style. For sorting, filtering, selection and pages, use a Data Table.
Usage
import { Component, ViewEncapsulation } from '@angular/core';import { ScTable, ScTableBody, ScTableCaption, ScTableCell, ScTableContainer, ScTableHeader, ScTableHeaderCell, ScTableRow,} from '@semantic-components/ui';
@Component({ selector: 'app-table-usage-demo', imports: [ ScTable, ScTableBody, ScTableCaption, ScTableCell, ScTableContainer, ScTableHeader, ScTableHeaderCell, ScTableRow, ], template: ` <div scTableContainer> <table scTable> <caption scTableCaption> A list of your recent invoices. </caption> <thead scTableHeader> <tr scTableRow> <th scTableHeaderCell class="w-24">Invoice</th> <th scTableHeaderCell>Status</th> <th scTableHeaderCell>Method</th> <th scTableHeaderCell class="text-end">Amount</th> </tr> </thead> <tbody scTableBody> @for (invoice of invoices; track invoice.id) { <tr scTableRow> <td scTableCell class="font-medium">{{ invoice.id }}</td> <td scTableCell>{{ invoice.status }}</td> <td scTableCell>{{ invoice.method }}</td> <td scTableCell class="text-end">{{ invoice.amount }}</td> </tr> } </tbody> </table> </div> `, host: { class: 'block w-full' }, encapsulation: ViewEncapsulation.None,})export class TableUsageDemo { private readonly invoices = [ { id: 'INV001', status: 'Paid', method: 'Credit Card', amount: '$250.00' }, { id: 'INV002', status: 'Pending', method: 'PayPal', amount: '$150.00' }, { id: 'INV003', status: 'Unpaid', method: 'Bank Transfer', amount: '$350.00', }, { id: 'INV004', status: 'Paid', method: 'Credit Card', amount: '$450.00' }, { id: 'INV005', status: 'Paid', method: 'PayPal', amount: '$550.00' }, { id: 'INV006', status: 'Pending', method: 'Bank Transfer', amount: '$200.00', }, { id: 'INV007', status: 'Unpaid', method: 'Credit Card', amount: '$550.00', }, ];}Anatomy
Every part is a directive on the native element, so the table stays a table to screen readers: its caption names it, its header cells name their columns.
import { ScTableContainer, ScTable, ScTableCaption, ScTableHeader, ScTableBody, ScTableFooter, ScTableRow, ScTableHeaderCell, ScTableCell,} from '@semantic-components/ui';<div scTableContainer> <table scTable> <caption scTableCaption>…</caption> <thead scTableHeader> <tr scTableRow><th scTableHeaderCell>…</th></tr> </thead> <tbody scTableBody> <tr scTableRow><td scTableCell>…</td></tr> </tbody> <tfoot scTableFooter> <tr scTableRow><td scTableCell>…</td></tr> </tfoot> </table></div>Notes
- A table holds data, and data has column names: give it a header row, visually hidden when the look shows none (
<thead scTableHeader class="sr-only">). Without header cells it is a layout table to checkers such as WAVE, and screen readers lose the column names. Rows of things that aren't data (recent activity, a feed) are a list: an Item group (role="list"). A grid with no column names to give isdivs with ARIA roles, not a table (the Calendar's months view). - The container scrolls a wide table sideways instead of the page. Make it focusable and name it (
tabindex="0" role="region" aria-label) when it may scroll, so the keyboard can reach what is hidden. - A header cell for a row, not a column, takes
scope="row". - A row is highlighted on hover, while it holds an expanded control (
aria-expanded, an open menu) and when it hasdata-state="selected". - Align numbers with
text-end, nottext-right: it follows the reading direction.
Examples
Footer
| Invoice | Status | Method | Amount |
|---|---|---|---|
| INV001 | Paid | Credit Card | $250.00 |
| INV002 | Pending | PayPal | $150.00 |
| INV003 | Paid | Bank Transfer | $350.00 |
| Total | $750.00 | ||
import { Component, ViewEncapsulation } from '@angular/core';import { ScTable, ScTableBody, ScTableCell, ScTableContainer, ScTableFooter, ScTableHeader, ScTableHeaderCell, ScTableRow,Scrolling
| Order | Customer | Date | Status | Amount | |
|---|---|---|---|---|---|
| ORD-1042 | Olivia Martin | [email protected] | 2026-10-28 | Shipped | $1,999.00 |
| ORD-1043 | Jackson Lee | [email protected] | 2026-10-29 | Processing | $39.00 |
| ORD-1044 | Isabella Nguyen | [email protected] | 2026-10-30 | Delivered | $299.00 |
import { Component, ViewEncapsulation } from '@angular/core';import { ScFrame, ScTable, ScTableBody, ScTableCell, ScTableContainer, ScTableHeader, ScTableHeaderCell, ScTableRow,RTL
| الفاتورة | الحالة | طريقة الدفع | المبلغ |
|---|---|---|---|
| INV001 | مدفوعة | بطاقة ائتمان | 250.00 $ |
| INV002 | معلقة | PayPal | 150.00 $ |
| INV003 | غير مدفوعة | تحويل بنكي | 350.00 $ |
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScTable, ScTableBody, ScTableCaption, ScTableCell, ScTableContainer, ScTableHeader, ScTableHeaderCell,API reference
Each part takes class, merged over the style (cn: a later class wins).
| Part | Selector | Description |
|---|---|---|
ScTableContainer | div[scTableContainer] | Scrolls a wide table sideways. Framed: add scFrame (the style’s frame). |
ScTable | table[scTable] | The table: full width, its text size from the style. |
ScTableCaption | caption[scTableCaption] | Names the table; shown below it. |
ScTableHeader | thead[scTableHeader] | The header rows, a line below. |
ScTableBody | tbody[scTableBody] | The rows; no line below the last. |
ScTableFooter | tfoot[scTableFooter] | Totals: muted, a line above. |
ScTableRow | tr[scTableRow] | A row: a line below; highlighted on hover, with an expanded control, or data-state="selected". |
ScTableHeaderCell | th[scTableHeaderCell] | Names its column (or its row, with scope="row"). |
ScTableCell | td[scTableCell] | A cell; no padding at the end beside a checkbox. |