Skip to content

Table

Recent deployments.
Commit Environment Status
a3cd96e Production Live
b1b44c4 Staging Building
e14ae5a Preview Failed
Total 3
<div class="table-container">
<table class="table">
<thead>
<tr><th scope="col">Commit</th></tr>
</thead>
<tbody>
<tr><td>a3cd96e</td></tr>
</tbody>
</table>
</div>

The wrapper is what makes a wide table scroll instead of breaking the page. The class styles the real table elements, so thead, tfoot, caption and colspan all keep working.

Name Role
Ada Lovelace Owner
Grace Hopper Admin

data-state="selected" on a <tr> marks it. Pair it with aria-selected when the selection is something the user made.

Set dir="rtl" on the page or on any subtree — headers and cells align to the reading direction on their own. See the button page for a live example.

  • scope on every header. scope="col" or scope="row" is what tells a screen reader which cells a header describes.
  • A <caption> names the table and is announced before its contents. It beats a heading above the table, which is not associated with it.
  • Do not use a table for layout. If the data is not tabular, the row and column announcements are noise.
  • Keep to one header row where you can. Split and nested headers need headers and id on every cell to stay navigable.