datacss
Table
Table styling with divider, striped, hover, and size variants plus a responsive label layout.
CSS Variables
| Variable | Default | Scope | Description |
|---|---|---|---|
--z-table-active-bg | var(--z-info) | .z-table > tr.z-active, .z-table tbody tr.z-active | Background of rows marked with z-active. |
--z-table-active-bg-o | 8% | .z-table > tr.z-active, .z-table tbody tr.z-active | Opacity applied to the active row background. |
--z-table-caption-color | var(--z-muted-f) | .z-table caption | Caption text color. |
--z-table-caption-color-o | 100% | .z-table caption | Opacity applied to the caption color. |
--z-table-caption-font-size | 0.875rem | .z-table caption | Caption font size. |
--z-table-cell-padding | 1rem 0.75rem | .z-table | Padding of header and body cells. |
--z-table-expand-min-width | 10rem | .z-table-expand | Minimum width of z-table-expand cells. |
--z-table-footer-font-size | 0.875rem | .z-table tfoot | Font size of the footer (tfoot). |
--z-table-header-color | var(--z-muted-f) | .z-table th | Header text color. |
--z-table-header-color-o | 100% | .z-table th | Opacity applied to the header text color. |
--z-table-header-font-size | 0.875rem | .z-table th | Header font size. |
--z-table-header-font-weight | normal | .z-table th | Header font weight. |
--z-table-hover-bg | var(--z-muted) | .z-table-hover > tr:hover, .z-table-hover tbody tr:hover | Row background on hover. |
--z-table-hover-bg-o | var(--z-muted-o) | .z-table-hover > tr:hover, .z-table-hover tbody tr:hover | 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 applied to the hover background. |
--z-table-responsive-label-color | var(--z-muted-f) | .z-table-responsive | Label text color in the responsive layout. |
--z-table-responsive-label-color-o | 100% | .z-table-responsive | Opacity applied to the responsive label color. |
--z-table-responsive-label-size | 0.875rem | .z-table-responsive | Label font size in the responsive layout. |
--z-table-responsive-label-weight | 500 | .z-table-responsive | Label font weight in the responsive layout. |
--z-table-responsive-label-width | 50% | .z-table-responsive | Width of the label column in the responsive layout. |
--z-table-responsive-padding-y | 0.5rem | .z-table-responsive | 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 | 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 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) | 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. |