Table
Rows and columns of data.
Basic table
Use this for data in rows and columns. Use a caption and native header cells to describe the data.
| Flag | Status | Rollout |
|---|---|---|
| new-onboarding-flow | Enabled | 100% |
| pricing-page-v2 | Enabled | 25% |
| hedgehog-mode | Disabled | 0% |
| 3 flags, 2 enabled | ||
Surfaces
Use raised (the default) on the window background. Use plain inside a card, so there is no box in a box. Use outlined in a Section or another flat region.
| Event | This week |
|---|---|
| $pageview | 48,210 |
| $autocapture | 31,904 |
| insight viewed | 6,412 |
| Event | This week |
|---|---|
| $pageview | 48,210 |
| $autocapture | 31,904 |
| insight viewed | 6,412 |
| Event | This week |
|---|---|
| $pageview | 48,210 |
| $autocapture | 31,904 |
| insight viewed | 6,412 |
Density and stripes
Use compact for data that people scan, such as event lists and long API tables. Use default for tables that people read, such as pricing and comparisons. Stripes tint alternate rows.
| Event | Last 30 days |
|---|---|
| $pageview | 1,284,302 |
| $autocapture | 902,118 |
| $identify | 64,930 |
| $feature_flag_called | 41,207 |
| Event | Last 30 days |
|---|---|
| $pageview | 1,284,302 |
| $autocapture | 902,118 |
| $identify | 64,930 |
| $feature_flag_called | 41,207 |
Interactive rows
Move the pointer over a row to see its tint. Put links or buttons in the cells for actions.
Sortable headers
Click a header to sort. The caller keeps the sort state and orders the rows.
| $pageview | 48,210 |
| $autocapture | 31,904 |
| insight viewed | 6,412 |
| dashboard viewed | 3,870 |
| survey sent | 912 |
Sticky header
Set a maximum container height. The rows scroll below a header with a solid fill.
| Event | Last 30 days |
|---|---|
| $pageview | 337,470 |
| $pageleave | 168,735 |
| $autocapture | 112,490 |
| $identify | 84,371 |
| $groupidentify | 67,494 |
| $feature_flag_called | 56,245 |
| $exception | 48,209 |
| $rageclick | 42,182 |
| $dead_click | 37,499 |
| $web_vitals | 33,747 |
| $survey_shown | 30,681 |
| $survey_sent | 28,126 |
| $survey_dismissed | 25,956 |
| $create_alias | 24,108 |
| $set | 22,498 |
| $opt_in | 21,091 |
Numeric columns and footer
Align numbers at the end of each column. Cells use tabular numerals, so digits line up.
| Source | Events | Share |
|---|---|---|
| Web (posthog-js) | 2,481,903 | 62.4% |
| iOS | 812,440 | 20.4% |
| Android | 401,227 | 10.1% |
| Backend (posthog-python) | 282,019 | 7.1% |
| Total | 3,977,589 | 100.0% |
Usage
These are defaults, not laws. Break one when you have a good reason, or when it makes the design more cohesive or more interesting.
- To line up the columns of several tables, add
table-fixedtoTable.Rootand give each table the same<colgroup>widths. - Name the table with
Caption, and setscope="row"on row headers. - The table only shows data. Sorting, filtering, pagination, and number formats are yours to supply.
- Cell styles use
!classes to beat prose table styles. Use!to override them, such as!px-0.
API
Table is a site component. Its parts accept native table element props.
Table.Root
| Prop | Type | Default | Description |
|---|---|---|---|
| appearance | 'plain' | 'outlined' | 'raised' | 'raised' | Sets the scroll container surface. Plain has no border or fill. Raised adds elevation. |
| density | 'compact' | 'default' | 'default' | Sets vertical cell padding. |
| striped | boolean | false | Adds a tint to alternate body rows. |
| interactive | boolean | false | Adds a tint on body row hover. |
| stickyHeader | boolean | false | Keeps the header at the top of the scroll container. |
| containerProps | HTMLAttributes<HTMLDivElement> | – | Sets scroll container attributes, className, and style. Set its maximum height for vertical scroll. |
Table.Head
| Prop | Type | Default | Description |
|---|---|---|---|
| align | 'start' | 'center' | 'end' | 'start' | Sets text alignment. |
| sort | 'ascending' | 'descending' | 'none' | – | Shows the sort carets and sets aria-sort. Omit it for a column that does not sort. |
| onSort | () => void | – | Makes the header label a button. Set the next sort state in this callback. |
| scope | string | 'col' | Identifies the cells that this header describes. |
Table.Cell
| Prop | Type | Default | Description |
|---|---|---|---|
| align | 'start' | 'center' | 'end' | 'start' | Sets text alignment. |





