datacss

Table

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

CSS Variables

VariableDefaultScopeDescription
--z-table-active-bgvar(--z-info).z-table > tr.z-active, .z-table tbody tr.z-activeBackground of rows marked with z-active.
--z-table-active-bg-o8%.z-table > tr.z-active, .z-table tbody tr.z-activeOpacity applied to the active row background.
--z-table-caption-colorvar(--z-muted-f).z-table captionCaption text color.
--z-table-caption-color-o100%.z-table captionOpacity applied to the caption color.
--z-table-caption-font-size0.875rem.z-table captionCaption font size.
--z-table-cell-padding1rem 0.75rem.z-tablePadding of header and body cells.
--z-table-expand-min-width10rem.z-table-expandMinimum width of z-table-expand cells.
--z-table-footer-font-size0.875rem.z-table tfootFont size of the footer (tfoot).
--z-table-header-colorvar(--z-muted-f).z-table thHeader text color.
--z-table-header-color-o100%.z-table thOpacity applied to the header text color.
--z-table-header-font-size0.875rem.z-table thHeader font size.
--z-table-header-font-weightnormal.z-table thHeader font weight.
--z-table-hover-bgvar(--z-muted).z-table-hover > tr:hover, .z-table-hover tbody tr:hoverRow background on hover.
--z-table-hover-bg-ovar(--z-muted-o).z-table-hover > tr:hover, .z-table-hover tbody tr:hoverOpacity applied to the hover background.
--z-table-hover-transitionbackground-color 150ms ease-in-out.z-table-hover > tr:hover, .z-table-hover tbody tr:hoverTransition applied to the hover background.
--z-table-responsive-label-colorvar(--z-muted-f).z-table-responsiveLabel text color in the responsive layout.
--z-table-responsive-label-color-o100%.z-table-responsiveOpacity applied to the responsive label color.
--z-table-responsive-label-size0.875rem.z-table-responsiveLabel font size in the responsive layout.
--z-table-responsive-label-weight500.z-table-responsiveLabel font weight in the responsive layout.
--z-table-responsive-label-width50%.z-table-responsiveWidth of the label column in the responsive layout.
--z-table-responsive-padding-y0.5rem.z-table-responsiveVertical cell padding in the responsive layout.
--z-table-responsive-stack-gap0.25rem.z-table-responsive.z-table-responsive-stack td[data-label]::beforeGap between label and value in the stacked responsive variant.
--z-table-striped-bgvar(--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-ovar(--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

ClassRoleApplies toDescription
.z-tableroot.z-tableFull-width collapsed table with padded cells.
.z-table-dividermodifier.z-tableTop border on every row except the first.
.z-table-expandutility.z-tableCell utility: minimum width so the column claims free space.
.z-table-hovermodifier.z-tableTinted background on row hover with a short transition.
.z-table-justifymodifier.z-tableRemoves outer cell padding so the table aligns with surrounding content.
.z-table-largemodifier.z-tableLarger cell padding.
.z-table-linkutility.z-tableCell utility: moves padding onto a block-level link filling the cell.
.z-table-middlemodifier.z-tableVertically centers cell content.
.z-table-responsivemodifier.z-tableBelow 48rem, rows stack into blocks and td[data-label] cells show their label inline.
.z-table-responsive-compactmodifier.z-tableNarrower label column and tighter row padding in the responsive layout.
.z-table-responsive-stackmodifier.z-tableResponsive variant that places each label above its value instead of beside it.
.z-table-shrinkutility.z-tableCell utility: collapses the column to its content width.
.z-table-smallmodifier.z-tableSmaller cell padding.
.z-table-stripedmodifier.z-tableTinted background and borders on odd rows.