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.

NameStatus
AlphaActive
BetaPending

Essential markup (repeated rows are omitted):

HTML
<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-striped adds alternating rows.
  • .table-hover highlights the pointed row.
  • .table-bordered adds cell borders; .table-borderless removes them.
  • .table-sm reduces cell padding; .is-active highlights one row.
VariantValue
Compact rowOne
Active rowTwo

Essential markup (keep the native headers and rows from the preview):

HTML
<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.

RecordStatus
AlphaIncomplete
BetaInvalid
HTML
<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.

HTML
<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, tbody and 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-responsive region 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.

TokenDefaultPurposeScope / state
--table-colorvar(--text-color)Text and icon color..table
--table-bg-colorvar(--bg-surface)Background color..table
--table-border-widthvar(--border-width)Border thickness..table
--table-border-colorvar(--border-color)Border color..table
--table-margin-bottomvar(--spacer-3)Space below the table..table
--table-cell-padding-yvar(--spacer-2)Cell top and bottom padding..table
--table-cell-padding-xvar(--spacer-2)Cell left and right padding..table
--table-header-colorvar(--text-color)Header cell text color..table
--table-header-bg-colorvar(--bg-surface-hover)Header cell background..table
--table-striped-bg-colorcolor-mix(in srgb, var(--table-bg-color) 98%, var(--table-color))Background of alternating body rows..table-striped: alternating rows
--table-striped-colorvar(--table-color)Text color of alternating body rows..table-striped: alternating rows
--table-hover-bg-colorvar(--bg-highlight)Body row background on hover..table-hover: row hover
--table-hover-colorvar(--table-color)Body row text color on hover..table-hover: row hover
--table-active-bg-colorvar(--bg-active)Active row background..table: .is-active row
--table-active-colorvar(--table-color)Active row text color..table: .is-active row
--table-row-state-accent-width0.25remWidth of the leading invalid or warning accent..table
--table-row-state-accent-offset-xvar(--table-row-state-accent-width)Accent inset direction; RTL negates the width..table
--table-row-invalid-bg-colorcolor-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-colorcolor-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-colorrgb(from var(--error) r g b / 0.35)Invalid row bottom border..table: .is-invalid row
--table-row-invalid-accent-colorvar(--error)Invalid row leading accent..table: .is-invalid row
--table-row-warning-bg-colorcolor-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-colorcolor-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-colorrgb(from var(--warning) r g b / 0.35)Warning row bottom border..table: .is-warning row
--table-row-warning-accent-colorvar(--warning)Warning row leading accent..table: .is-warning row