Data display

Table

Hairlines between rows only. Sortable headers, a selection column, striped and compact variants.

Examples

Table

Status
AtlasMika42 Review
HarborJun9 Draft
NorthlightAda128 Live

Busy

aria-busy dims the rows and pulses three squares over them.
ProjectPages
Atlas42
Harbor9

Anatomy

.table-scrollOptional wrapper that scrolls a wide table sideways instead of the page.
table.tableA real <table> with <thead> and <tbody>. Numbers are tabular; rows hover-tint.
th[aria-sort]Optional sortable header. Draws a triangle that turns with the direction.
th > input[type=checkbox]Optional selection column: a cell holding only a checkbox shrinks to fit it.
td[data-num]Numeric cells and their header align to the end.

API

AttributeValuesDescription
data-numbooleanOn a th or td: aligns the cell to the end, for figures that should line up.
aria-sorton thascendingdescendingnoneSortable header. none shows a faint triangle; the other two show it solid, pointing the sort direction.
aria-selectedon trtrueTints the row with the accent, for rows ticked in the selection column.
data-stripedon .tablebooleanTints every even body row.
data-sizeon .tablesTighter cell padding and smaller type, for dense data.
data-stickyon .tablebooleanHeader cells stick to the top of the nearest scrolling ancestor.
data-fixedon .tablebooleanFixed table layout: column widths come from the first row, not the content.
data-hoveron .tablefalseTurns off the row hover tint, for tables whose rows do nothing.
aria-busytrueDims the content and pulses three squares over it; the table ignores the pointer.

Behaviour

With checkboxes in the tbody, a checkbox in the thead selects or clears every row, each checked row gets aria-selected="true", the header box turns indeterminate for a partial selection, and a sibling .selection-bar shows the count. Without it, the checkboxes are plain inputs and the rows tint only where you set aria-selected.

From aequitas.js. It initialises itself and enhances markup added later on its own, so it works the same in an SPA.

Accessibility

  • aria-sort only draws the arrow; sorting is up to you. Put a <button> inside the th so the header can be sorted from the keyboard.
  • aria-selected is not announced on rows of a plain table. The row's checkbox carries the state; give each one an aria-label naming the row.
  • Keep <th> in <thead> so cells are announced with their column; use <th scope="row"> for a row header.
  • A .table-scroll wrapper that overflows needs tabindex="0" and an aria-label in browsers that don't make scroll containers focusable.
Jump to
ProportionFoundations
MaterialFoundations
PresetsFoundations
ShellLayouts · Application
Container and stacksLayouts · Pages
SplitLayouts · Pages
Grid, bento, masonryLayouts · Pages
Switcher and rowLayouts · Pages
↑↓Move↵OpenescClose