Menu

Components

Table

A table with rules only between rows: no zebra, no vertical rules, the label class for its head.

Usage

Table

TokenValue
--radius0.625rem
--radius-xs0.25rem
--radius-xl0.75rem
--radius-2xl1rem
--radius-flat1.25rem
--radius-card1.0625rem
<div className="overflow-x-auto" tabIndex={0} role="region" aria-label="Radius tokens">
  <table className="w-full border-collapse text-left">
    <thead>
      <tr className="border-b border-border">
        <th scope="col" className="aka-label pb-2 pr-4 font-medium">Token</th>
        <th scope="col" className="aka-label pb-2 font-medium">Value</th>
      </tr>
    </thead>
    <tbody>
      {tokens.map((t) => (
        <tr key={t.name} className="border-b border-border/40 last:border-0">
          <th scope="row" className="py-2 pr-4 font-mono text-11 font-normal text-foreground/85">{t.name}</th>
          <td className="py-2 font-mono text-11 text-muted-foreground">{t.light}</td>
        </tr>
      ))}
    </tbody>
  </table>
</div>

Every token table on these pages is this table. Rules between rows only, because a grid of lines is louder than the numbers in it.

Best practices

When to use

  • Data with more than one attribute per row: tokens, props, comparisons.
  • A list instead when each row is one thing.

Behaviour

  • A full rule under the head and a fainter one between rows; the last row has none.
  • Wide tables scroll inside their own wrapper, never the page.

Accessibility

  • th with scope for the column heads, and for the first cell of a row when it names the row.
  • The scrolling wrapper is focusable and named, so a keyboard can reach and scroll it.