Create

General

Table

New
Copy page View as Markdown Open in ChatGPT Open in Claude

A responsive table component.

Usage#

app.component.ts
import { WdsTableComponent } from '@wds/angular/table';

Put a native <table> in wds-table: the element styles it and scrolls it horizontally when it does not fit. Align and size cells with your own classes (e.g. text-end tabular-nums, w-24). For sorting, filtering, selection and pagination driven by data use Data Table.

Examples#

Default#

A caption under the table, a header row in thead, and a total in tfoot. Rows highlight on hover.

A list of your recent invoices.
Invoice Status Method Amount
INV001 Paid Credit card $250.00
INV002 Pending PayPal $150.00
INV003 Unpaid Bank transfer $350.00
INV004 Paid Credit card $450.00
Total $1,200.00

Bordered and striped#

bordered draws a rounded border around the table and striped shades every other row. Row headers are <th scope="row">.

Region Orders Revenue Change
North America 1,284 $48,210 +12.4%
Europe 936 $35,870 +8.1%
Asia Pacific 712 $24,630 −2.3%
Latin America 318 $9,940 +4.7%

Small#

size="sm" gives shorter rows for dense data.

Key Value
region eu-central-1
runtime node 22
memory 1024 MB
timeout 30 s
replicas 3

sticky-header keeps the header row visible while the rows scroll. Give the table a maximum height (here max-h-72). A table that scrolls and has nothing to focus can be scrolled with the keyboard and is a region named by its caption.

Pipeline runs in September
Date Job Service Result Duration
Mon, Sep 1 Deploy api Success 42 s
Mon, Sep 1 Migration db Success 3 min
Tue, Sep 2 Deploy web Failed 1 min
Tue, Sep 2 Rollback web Success 38 s
Wed, Sep 3 Deploy web Success 51 s
Thu, Sep 4 Backup db Success 12 min
Fri, Sep 5 Deploy api Success 40 s
Mon, Sep 8 Deploy worker Success 35 s
Tue, Sep 9 Migration db Success 2 min
Wed, Sep 10 Deploy api Failed 1 min
Wed, Sep 10 Deploy api Success 44 s
Thu, Sep 11 Backup db Success 11 min

Rich cells#

Cells can hold any content: an avatar with two lines of text, a badge, an actions button. The actions column has a hidden header.

Member Role Status Last active Actions
MS
Mira Stone
Owner Active 2 min ago
SQ
Sana Qureshi
Admin Active 1 h ago
IV
Ivo Vidal
Member Invited —

Selected row#

aria-selected="true" (or data-selected) on a row gives it the selected background.

Name Owner Size
Q3 report.pdf Mira Stone 2.4 MB
Roadmap.key Sana Qureshi 18.1 MB
Brand assets.zip Ivo Vidal 146 MB

API References#

wds-table#

A plain table in the WDS style: put a native <table> (with caption, thead, tbody, tfoot) inside. The element styles the rows and cells and scrolls the table horizontally when it does not fit. For sorting, filtering, selection and pagination driven by data use wds-data-table. Mark a selected row with aria-selected="true" (or data-selected). Align numbers with your own classes on the cells, e.g. text-end tabular-nums.

Attributes

AttributeTypeDefaultDescription
sizeWdsTableSize'default'Row height: sm for dense tables.
stripedbooleanfalseEvery other row gets a muted background.
borderedbooleanfalseA rounded border around the table.
sticky-header.stickyHeaderbooleanfalseThe header row stays at the top while the rows scroll. Give the table a maximum height (e.g. max-h-80), so it scrolls inside.
labelstring''Accessible name of the scrolling region, when the table scrolls. Defaults to the text of the <caption>.

Slots

SlotDescription
(default)A <table>.

CSS parts (::part)

PartDescription
containerThe scrolling container (and the border with bordered).

Accessibility#

Screen reader#

The content is a native <table>, so screen readers announce rows, columns and the header of each cell. Use <th scope="col"> for column headers and <th scope="row"> for row headers.

Name the table with a <caption> (or aria-label on the <table>). When the table scrolls and has no focusable content, its container is a region named by the caption (or label) and can be focused, so it can be scrolled with the keyboard.

Give buttons without text in cells a name (label on wds-button), e.g. "Actions for Mira Stone".

Keyboard support#

KeyFunction
TabMoves focus to the links and buttons in the table, or to the table itself when it scrolls and has none.
←→↑↓Scrolls a focused table that does not fit.
Footer