Table
A grid of rows and columns that lets users compare records.
A table arranges records in rows and their values in columns, so users compare records by reading down a column. Its header names the columns, its body holds one row per record, and a footer and a caption can summarize and name the table. Cells keep their content on one line, and the table scrolls horizontally when its columns need more room than its container offers. A row takes a background of its own while users hover over it, while a control inside it is expanded, such as the trigger of an open menu, and when it carries data-state="selected".
| Transfer | Destination | Status | Cases |
|---|---|---|---|
| 4821 | Basel | In transit | 12 |
| 4822 | Bern | Scheduled | 8 |
| 4823 | Zurich | Received | 6 |
Usage
Examples
With Caption
A page with several tables, or a table that users reach with a screen reader, needs a name that tells what its records are about. TableCaption provides that name as part of the table itself, so assistive technology also uses it as the name of the table.
| Transfer | Destination | Status | Cases |
|---|---|---|---|
| 4821 | Basel | In transit | 12 |
| 4822 | Bern | Scheduled | 8 |
| 4823 | Zurich | Received | 6 |
With Footer
Figures in a column often matter most as a sum, for example the stock of every store together. Set apart from the records in TableFooter, the sums give users the result without making them add up the rows themselves.
| Transfer | Destination | Status | Cases |
|---|---|---|---|
| 4821 | Basel | In transit | 12 |
| 4822 | Bern | Scheduled | 8 |
| 4823 | Zurich | Received | 6 |
| Total | 26 | ||
Selected Row
While users work on one record, for example in a panel with its details, they need to find its row again at a glance. Once a row carries data-state with the value "selected", it stands apart from the other rows, so users keep their place as they move between the table and the details.
| Transfer | Destination | Status | Cases |
|---|---|---|---|
| 4821 | Basel | In transit | 12 |
| 4822 | Bern | Scheduled | 8 |
| 4823 | Zurich | Received | 6 |
With Checkbox
Some tasks apply to several records at once, such as reordering a range of products in one step. With a Checkbox in every row, users choose those records before they act, and one more checkbox selects or clears all of them together. Each chosen row also carries data-state with the value "selected", so users see the whole selection while they scan the table.
| Transfer | Destination | Status | Cases | |
|---|---|---|---|---|
| 4821 | Basel | In transit | 12 | |
| 4822 | Bern | Scheduled | 8 | |
| 4823 | Zurich | Received | 6 |
With Actions
Correcting a quantity or cancelling an order concerns a single record, so the action belongs with that record. Gathered in a DropdownMenu, the actions stay within reach in every row without crowding the figures, and the row remains marked while its menu is open, so users see which record they are acting on.
| Transfer | Destination | Status | Cases | Actions |
|---|---|---|---|---|
| 4821 | Basel | In transit | 12 | |
| 4822 | Bern | Scheduled | 8 | |
| 4823 | Zurich | Received | 6 |
Horizontal Scroll
On a narrow screen or in a side panel, a table often has less room than its columns need. Instead of wrapping its values onto several lines, the table then scrolls horizontally, so each record stays on one line and users read it across all its columns.
| Transfer | Origin | Destination | Status | Cases | Weight | Delivery window |
|---|---|---|---|---|---|---|
| 4821 | Central warehouse | Basel | In transit | 12 | 96 kg | 6:00 to 8:00 |
| 4822 | Central warehouse | Bern | Scheduled | 8 | 64 kg | 6:00 to 8:00 |
| 4823 | Regional warehouse | Zurich | Received | 6 | 48 kg | 7:00 to 9:00 |
With Frame
Where a table sits among forms, text or charts, its records can blend into the content around it. Wrapped in a TableFrame, the table forms a contained unit, so users see at once where its records begin and end.
| Transfer | Destination | Status | Cases |
|---|---|---|---|
| 4821 | Basel | In transit | 12 |
| 4822 | Bern | Scheduled | 8 |
| 4823 | Zurich | Received | 6 |
API Reference
Table
Table holds the caption, the header, the body and the footer, and scrolls horizontally when it is wider than its container. It renders a table inside a div and has no props of its own.
TableHeader
TableHeader groups the rows that name the columns. It renders a thead and has no props of its own.
TableBody
TableBody groups the rows that hold the records. It renders a tbody and has no props of its own.
TableFooter
TableFooter summarizes the columns below the body, for example with a total, and a border and a background of its own set it apart from the body. It renders a tfoot and has no props of its own.
TableRow
TableRow holds the heads or the cells of one row and takes a background of its own while users hover over it, while a control inside it is expanded, and when it carries data-state="selected". It renders a tr and has no props of its own.
TableHead
TableHead names a column and drops its right padding when it contains a checkbox. It renders a th and has no props of its own.
TableCell
TableCell holds one value of a row and drops its right padding when it contains a checkbox. It renders a td and has no props of its own.
TableCaption
TableCaption names the table for users and assistive technology and appears below the table. It renders a caption and has no props of its own.