Table
Structured data in rows and columns.
When to use
Use a table for data whose meaning depends on row and column relationships. Use Grid for page layout and List for a simple collection without cross-column comparisons.
Default
Use .table with native elements and scoped headers.
| Name | Status |
|---|---|
| Alpha | Active |
| Beta | Pending |
Essential markup (repeated rows are omitted):
<table class="table">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Alpha</th>
<td>Active</td>
</tr>
</tbody>
</table>Variants
Available modifiers:
.table-stripedadds alternating rows..table-hoverhighlights the pointed row..table-borderedadds cell borders;.table-borderlessremoves them..table-smreduces cell padding;.is-activehighlights one row.
| Variant | Value |
|---|---|
| Compact row | One |
| Active row | Two |
Essential markup (keep the native headers and rows from the preview):
<table class="table table-striped table-hover table-bordered table-sm">
<!-- Native table structure -->
</table>Row states
Use .is-warning or .is-invalid with visible status text.
Status fills mix with --table-bg-color so surrounding page colors do not show through. They take precedence over striped and active row backgrounds; hover strengthens the status tint. Keep custom table surfaces and text colors paired for readable contrast.
| Record | Status |
|---|---|
| Alpha | Incomplete |
| Beta | Invalid |
<tr class="is-warning">
<th scope="row">Alpha</th>
<td>Incomplete</td>
</tr>
<tr class="is-invalid">
<th scope="row">Beta</th>
<td>Invalid</td>
</tr>Responsive
Wrap wide tables in an accessibly named, focusable .table-responsive region.
<div class="table-responsive" role="region" tabindex="0" aria-label="Records">
<table class="table">
<!-- Native table structure -->
</table>
</div>Accessibility and behavior
- Use native
table,thead,tbodyand header cells. Name the table with a caption or a clear accessible label and scope column and row headers appropriately. - Keep status meaning in text. Hover or active-row styling does not create row selection or sorting behavior; those controls need native buttons and application state.
- Place wide data in a named, focusable
.table-responsiveregion so keyboard users can scroll it. Keep horizontal overflow inside that region.
CSS variables
Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.
| Token | Default | Purpose | Scope / state |
|---|---|---|---|
--table-color | var(--text-color) | Text and icon color. | .table |
--table-bg-color | var(--bg-surface) | Background color. | .table |
--table-border-width | var(--border-width) | Border thickness. | .table |
--table-border-color | var(--border-color) | Border color. | .table |
--table-margin-bottom | var(--spacer-3) | Space below the table. | .table |
--table-cell-padding-y | var(--spacer-2) | Cell top and bottom padding. | .table |
--table-cell-padding-x | var(--spacer-2) | Cell left and right padding. | .table |
--table-header-color | var(--text-color) | Header cell text color. | .table |
--table-header-bg-color | var(--bg-surface-hover) | Header cell background. | .table |
--table-striped-bg-color | color-mix(in srgb, var(--table-bg-color) 98%, var(--table-color)) | Background of alternating body rows. | .table-striped: alternating rows |
--table-striped-color | var(--table-color) | Text color of alternating body rows. | .table-striped: alternating rows |
--table-hover-bg-color | var(--bg-highlight) | Body row background on hover. | .table-hover: row hover |
--table-hover-color | var(--table-color) | Body row text color on hover. | .table-hover: row hover |
--table-active-bg-color | var(--bg-active) | Active row background. | .table: .is-active row |
--table-active-color | var(--table-color) | Active row text color. | .table: .is-active row |
--table-row-state-accent-width | 0.25rem | Width of the leading invalid or warning accent. | .table |
--table-row-state-accent-offset-x | var(--table-row-state-accent-width) | Accent inset direction; RTL negates the width. | .table |
--table-row-invalid-bg-color | color-mix(in srgb, var(--error) 8%, var(--table-bg-color)) | Invalid tint mixed with the table surface. | .table: .is-invalid row |
--table-row-invalid-hover-bg-color | color-mix(in srgb, var(--error) 12%, var(--table-bg-color)) | Invalid hover tint mixed with the table surface. | .table: .is-invalid row |
--table-row-invalid-border-color | rgb(from var(--error) r g b / 0.35) | Invalid row bottom border. | .table: .is-invalid row |
--table-row-invalid-accent-color | var(--error) | Invalid row leading accent. | .table: .is-invalid row |
--table-row-warning-bg-color | color-mix(in srgb, var(--warning) 10%, var(--table-bg-color)) | Warning tint mixed with the table surface. | .table: .is-warning row |
--table-row-warning-hover-bg-color | color-mix(in srgb, var(--warning) 14%, var(--table-bg-color)) | Warning hover tint mixed with the table surface. | .table-hover: row hover |
--table-row-warning-border-color | rgb(from var(--warning) r g b / 0.35) | Warning row bottom border. | .table: .is-warning row |
--table-row-warning-accent-color | var(--warning) | Warning row leading accent. | .table: .is-warning row |