StartFoundationsComponentsContent

Table

Table styles a real <table> you write and makes it scrollable by keyboard when it is too wide.

Stable Figma
OverviewUsageAPIAccessibility
Quarterly revenue by region
RegionQ1Q2
North1,2041,310
South9871,045
Total2,1912,355
<tk-table>
  <table>
    <caption>Quarterly revenue by region</caption>
    <thead><tr><th scope="col">Region</th><th scope="col" data-numeric>Q1</th><th scope="col" data-numeric>Q2</th></tr></thead>
    <tbody>
      <tr><th scope="row">North</th><td data-numeric>1,204</td><td data-numeric>1,310</td></tr>
      <tr><th scope="row">South</th><td data-numeric>987</td><td data-numeric>1,045</td></tr>
    </tbody>
    <tfoot><tr><th scope="row">Total</th><td data-numeric>2,191</td><td data-numeric>2,355</td></tr></tfoot>
  </table>
</tk-table>

Anatomy

Part What it is
tk-table the bordered, rounded container
default slot your <table>, with <caption>, <thead>, <tbody>, and <tfoot>
<caption> the title band; it names the table
<thead> the header row, in medium secondary text
<th scope="row"> a row header, in medium text
<tfoot> the total row, in semibold text
scroll part the scroll container around the table

Density

Open incidents
ServiceStatus
PaymentsInvestigating
SearchResolved
<tk-table density="compact">
  <table>
    <caption>Open incidents</caption>
    <thead><tr><th scope="col">Service</th><th scope="col">Status</th></tr></thead>
    <tbody><tr><td>Payments</td><td>Investigating</td></tr><tr><td>Search</td><td>Resolved</td></tr></tbody>
  </table>
</tk-table>
density Cell padding
comfortable (default) space-12 × space-16
compact space-8 × space-12

Options

Team members
NameRole
Alice ChenDesign
Bo NguyenEngineering
Carla DiazResearch
<tk-table zebra hover header-fill>
  <table>
    <caption>Team members</caption>
    <thead><tr><th scope="col">Name</th><th scope="col">Role</th></tr></thead>
    <tbody><tr><td>Alice Chen</td><td>Design</td></tr><tr><td>Bo Nguyen</td><td>Engineering</td></tr><tr><td>Carla Diaz</td><td>Research</td></tr></tbody>
  </table>
</tk-table>
  • zebra: shades every other row. Use it on wide, dense tables.
  • hover: highlights the row under the pointer. It can suggest a row is clickable, so use it only when it helps people follow a row.
  • header-fill: fills the header row with a subtle band. By default the header has no fill.

Zebra rows and hover are decoration. Headers and cell text carry the meaning.

sticky keeps the header row in view as the table scrolls. It needs a maximum height on the scroll part.

<style>
  tk-table::part(scroll) { max-height: 320px; }
</style>
<tk-table sticky>
  <table>…</table>
</tk-table>

The class

The tk-table class styles a table without the element. It takes the same options as data-* attributes, but has no scroll region: a table wider than its container is cut off. Use <tk-table> for any table that can overflow.

Shortcuts
ActionKeys
SearchCtrl K
SaveCtrl S
<div class="tk-table" data-density="compact" data-zebra>
  <table>
    <caption>Shortcuts</caption>
    <thead><tr><th scope="col">Action</th><th scope="col">Keys</th></tr></thead>
    <tbody><tr><td>Search</td><td>Ctrl K</td></tr><tr><td>Save</td><td>Ctrl S</td></tr></tbody>
  </table>
</div>