# Table (`.z-table`)

> Table styling with divider, striped, hover, and size variants plus a responsive label layout.

- **Kind:** css
- **Category:** data

## CSS Variables

| Variable | Default | Scope | Affects | Description |
| --- | --- | --- | --- | --- |
| `--z-table-active-bg` | `var(--z-info)` | `.z-table > tr.z-active, .z-table tbody tr.z-active` | `background-color` | Background of rows marked with `z-active`. |
| `--z-table-active-bg-o` | `8%` | `.z-table > tr.z-active, .z-table tbody tr.z-active` | `background-color` | Opacity applied to the active row background. |
| `--z-table-caption-color` | `var(--z-muted-f)` | `.z-table caption` | `color` | Caption text color. |
| `--z-table-caption-color-o` | `100%` | `.z-table caption` | `color` | Opacity applied to the caption color. |
| `--z-table-caption-font-size` | `0.875rem` | `.z-table caption` | `font-size` | Caption font size. |
| `--z-table-cell-padding` | `1rem 0.75rem` | `.z-table` | `left`, `padding`, `padding-left`, `top` | Padding of header and body cells. |
| `--z-table-expand-min-width` | `10rem` | `.z-table-expand` | `min-width` | Minimum width of `z-table-expand` cells. |
| `--z-table-footer-font-size` | `0.875rem` | `.z-table tfoot` | `font-size` | Font size of the footer (`tfoot`). |
| `--z-table-header-color` | `var(--z-muted-f)` | `.z-table th` | `color` | Header text color. |
| `--z-table-header-color-o` | `100%` | `.z-table th` | `color` | Opacity applied to the header text color. |
| `--z-table-header-font-size` | `0.875rem` | `.z-table th` | `font-size` | Header font size. |
| `--z-table-header-font-weight` | `normal` | `.z-table th` | `font-weight` | Header font weight. |
| `--z-table-hover-bg` | `var(--z-muted)` | `.z-table-hover > tr:hover, .z-table-hover tbody tr:hover` | `background-color` | Row background on hover. |
| `--z-table-hover-bg-o` | `var(--z-muted-o)` | `.z-table-hover > tr:hover, .z-table-hover tbody tr:hover` | `background-color` | Opacity applied to the hover background. |
| `--z-table-hover-transition` | `background-color 150ms ease-in-out` | `.z-table-hover > tr:hover, .z-table-hover tbody tr:hover` | `transition` | Transition applied to the hover background. |
| `--z-table-responsive-label-color` | `var(--z-muted-f)` | `.z-table-responsive` | `color` | Label text color in the responsive layout. |
| `--z-table-responsive-label-color-o` | `100%` | `.z-table-responsive` | `color` | Opacity applied to the responsive label color. |
| `--z-table-responsive-label-size` | `0.875rem` | `.z-table-responsive` | `font-size` | Label font size in the responsive layout. |
| `--z-table-responsive-label-weight` | `500` | `.z-table-responsive` | `font-weight` | Label font weight in the responsive layout. |
| `--z-table-responsive-label-width` | `50%` | `.z-table-responsive` | `padding-left`, `width` | Width of the label column in the responsive layout. |
| `--z-table-responsive-padding-y` | `0.5rem` | `.z-table-responsive` | `padding-bottom`, `padding-top` | Vertical cell padding in the responsive layout. |
| `--z-table-responsive-stack-gap` | `0.25rem` | `.z-table-responsive.z-table-responsive-stack td[data-label]::before` | `margin-bottom` | Gap between label and value in the stacked responsive variant. |
| `--z-table-striped-bg` | `var(--z-muted)` | `.z-table-striped > tr:nth-of-type(odd), .z-table-striped tbody tr:nth-of-type(odd)` | `background-color` | Background of odd striped rows. |
| `--z-table-striped-bg-o` | `var(--z-muted-o)` | `.z-table-striped > tr:nth-of-type(odd), .z-table-striped tbody tr:nth-of-type(odd)` | `background-color` | Opacity applied to the striped background. |

## CSS Classes

| Class | Role | Applies to | Description |
| --- | --- | --- | --- |
| `.z-table` | `root` | `.z-table` | Full-width collapsed table with padded cells. |
| `.z-table-divider` | `modifier` | `.z-table` | Top border on every row except the first. |
| `.z-table-expand` | `utility` | `.z-table` | Cell utility: minimum width so the column claims free space. |
| `.z-table-hover` | `modifier` | `.z-table` | Tinted background on row hover with a short transition. |
| `.z-table-justify` | `modifier` | `.z-table` | Removes outer cell padding so the table aligns with surrounding content. |
| `.z-table-large` | `modifier` | `.z-table` | Larger cell padding. |
| `.z-table-link` | `utility` | `.z-table` | Cell utility: moves padding onto a block-level link filling the cell. |
| `.z-table-middle` | `modifier` | `.z-table` | Vertically centers cell content. |
| `.z-table-responsive` | `modifier` | `.z-table` | Below 48rem, rows stack into blocks and `td[data-label]` cells show their label inline. |
| `.z-table-responsive-compact` | `modifier` | `.z-table` | Narrower label column and tighter row padding in the responsive layout. |
| `.z-table-responsive-stack` | `modifier` | `.z-table` | Responsive variant that places each label above its value instead of beside it. |
| `.z-table-shrink` | `utility` | `.z-table` | Cell utility: collapses the column to its content width. |
| `.z-table-small` | `modifier` | `.z-table` | Smaller cell padding. |
| `.z-table-striped` | `modifier` | `.z-table` | Tinted background and borders on odd rows. |

## Notes

- In the responsive layout, give each body cell a `data-label` attribute with its column header text; it renders via `::before`.
- Mark a selected row with `z-active` for the info-tinted highlight.

## Guides

- [Styling with cls and stl](https://next.0build.dev/docs/guides/styling.md)
- [Translating Components](https://next.0build.dev/docs/guides/i18n.md)
- [Icon Resolution](https://next.0build.dev/docs/guides/icons.md)
- [The data-source Convention](https://next.0build.dev/docs/guides/data-source.md)
- [Openers & Triggers](https://next.0build.dev/docs/guides/triggers.md)
- [Dialog Behavior](https://next.0build.dev/docs/guides/dialogs.md)
- [Utilities](https://next.0build.dev/docs/guides/utilities.md)
- [Runtime](https://next.0build.dev/docs/guides/runtime.md)
