Table
Use Table for plain tabular content that is already in rows and columns: a comparison, a list of props, a table in a Markdown message. For content that isn’t really a table, such as a set of items with pictures and actions, use Cards in a Grid; for thousands of rows, render them in a VirtualList.
Table styles a native <table> for plain tabular content. Its children are ordinary caption, colgroup, thead, tbody, tfoot, tr, th and td elements, so a Markdown renderer can map table to Table and leave the rest alone. It has no columns or data API, sorting or selection.
#Demos
#Basic
Header cells in thead get the header style; a caption names the table above it.
| Step | Owner | Status |
|---|---|---|
| Freeze the branch | Release captain | Done |
| Run the smoke tests | QA | In progress |
| Publish the notes | Docs | Waiting |
#Size
| Size | Use |
|---|---|
| small | Dense panels |
| small | Cell padding and text size follow it |
| Size | Use |
|---|---|
| medium | Documents |
| medium | Cell padding and text size follow it |
| Size | Use |
|---|---|
| large | Roomy pages |
| large | Cell padding and text size follow it |
#Bordered
bordered={false} drops the frame. Without a frame, bottomBordered={false} also drops the divider under the last row.
| bordered={false} | Last row |
|---|---|
| No frame | Keeps its divider |
| Sits in the text | Like this one |
| bottomBordered={false} | Last row |
|---|---|
| No frame | Divided |
| And no closing line | Open at the bottom |
#Column dividers
singleLine is on by default and divides rows only; singleLine={false} divides the columns as well.
| Region | Q1 | Q2 | Q3 |
|---|---|---|---|
| North | 1,240 | 1,310 | 1,402 |
| South | 980 | 1,050 | 1,126 |
#Single column
singleColumn removes the dividers between body rows.
| Shortcut | Action |
|---|---|
| Ctrl K | Open the command menu |
| Ctrl / | Toggle the sidebar |
| Esc | Close the panel |
#Striped
| Service | Region | Uptime |
|---|---|---|
| api-gateway | eu-west-1 | 99.98% |
| auth | eu-west-1 | 99.95% |
| billing | us-east-1 | 99.90% |
| search | us-east-1 | 99.97% |
| notifications | ap-south-1 | 99.93% |
#Alignment
A cell’s align attribute, which GFM emits for :---, :---: and ---:, and an inline text-align both win over the table’s start alignment.
| Item | Qty | Price |
|---|---|---|
| Notebook | 3 | $12.00 |
| Fountain pen | 1 | $48.50 |
| Ink, blue-black | 2 | $9.75 |
#Wide tables
A table wider than its container scrolls sideways in its wrapper, a ScrollArea, instead of overflowing the page. While it overflows, the wrapper is a region named by scrollRegionLabel and a tab stop, so keyboard users can scroll it with the arrow keys. Text in body cells wraps; header cells stay on one line. Inside a flex or grid item, give that item min-width: 0, or it grows to fit the table instead of letting it scroll.
| Run | Branch | Commit | Started | Duration | Build | Lint | Unit | E2E | Deploy |
|---|---|---|---|---|---|---|---|---|---|
| #4812 | main | 0cede83 | 09:12 | 6m 41s | Passed | Passed | Passed | Passed | Staging |
| #4811 | feat/table | 376380a | 08:55 | 7m 02s | Passed | Passed | Failed | Skipped | None |
| #4810 | fix/select-focus | 76df891 | 08:31 | 5m 58s | Passed | Passed | Passed | Passed | Preview |
#Markdown
The elements a Markdown renderer emits for a GFM table, with table mapped to Table. Inline code, links and emphasis keep the surrounding prose styles.
The table sits in the text like any other block.
| Option | Type | Default | Notes |
|---|---|---|---|
bordered | boolean | true | Frames the table. |
size | 'small' | 'medium' | 'large' | 'medium' | See Size. |
striped | boolean | false | Shades every other row; long notes wrap inside the cell instead of widening it. |
#Table Props
| Name | Type | Default | Description | Version |
|---|---|---|---|---|
bordered | boolean | true | Draws a frame around the table. Falls back to ConfigProvider’s bordered. | Unreleased |
bottomBordered | boolean | true | Keeps the divider under the last row. Has no effect while bordered: the frame closes the table. | Unreleased |
scrollRegionLabel | string | locale: Scrollable table | Accessible name of the wrapper while it scrolls. | Unreleased |
singleColumn | boolean | false | Removes the dividers between rows. | Unreleased |
singleLine | boolean | true | Removes the dividers between columns. | Unreleased |
size | small | medium | large | medium | Cell padding and text size. | Unreleased |
striped | boolean | false | Shades every other body row. | Unreleased |
Every other prop, className, style and ref go to the <table> element. The wrapper has the class p-table-wrapper; put spacing such as a Markdown block margin on it.
Inside it, use the native thead, tr, th and other table elements.