# Table

Rows of the same kind of thing, such as roles or applications, compared column by column.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/table shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

A `<table class="dex-table">`: hairline rows, no outer border, no stripes, numbers right-aligned in mono with `dex-num`. In a product mock the app's table sits on a card, so put it in a `dex-card`; in a report or a deck it stands on the page.

```html
<div class="dex-card">
  <div class="dex-table-scroll">
    <table class="dex-table">
      <thead>
        <tr><th>Role</th><th>Stage</th><th class="dex-num" aria-sort="descending"><button class="dex-link">Salary ↓</button></th><th aria-label="Actions"></th></tr>
      </thead>
      <tbody>
        <tr>
          <td><b>Senior backend engineer</b><span class="dex-small dex-muted" style="display: block">Synthesia · London</span></td>
          <td><span class="dex-badge dex-badge--success">Offer</span></td>
          <td class="dex-num">£130,000</td>
          <td><button class="dex-button dex-button--ghost dex-button--sm" style="width: 2rem; padding: 0" aria-label="More for Senior backend engineer"><svg aria-hidden="true"><!-- Lucide ellipsis --></svg></button></td>
        </tr>
        <tr>
          <td><b>Staff platform engineer</b><span class="dex-small dex-muted" style="display: block">Ledgerline · London, 3 days/wk</span></td>
          <td><span class="dex-badge dex-badge--outline">Applied</span></td>
          <td class="dex-num">£145,000</td>
          <td><!-- the same button --></td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
```

- **Wider than its space**: wrap it in `dex-table-scroll`, which scrolls sideways on a phone. Never clip a table with an `overflow` wrapper of your own. The app also fades the cut-off edge; `dex.css` doesn't.
- **Caption**: `<caption class="dex-small dex-muted" style="caption-side: bottom; text-align: left; padding-top: 0.75rem">`.
- **Footer**: a `<tfoot>` row for totals, its figures in `dex-num` cells.
- **Sortable column**: the header holds a button (a `dex-link`) with an arrow, and `aria-sort` on the `<th>`. Your script sorts the rows.
- **Row actions**: an icon-only ghost button at the end of the row, opening a dropdown menu (https://brand.meetdex.ai/components/dropdown-menu.md).
- **The row that matters** (reports, decks): `dex-row--highlight` on it and `dex-cell--highlight` on its key cell. Not in product mocks.
- **Plain, with a sticky header**: in the app, a page that is the table (such as every role in an internal tool) uses a plain variant: dense 44px rows, no card, no lines between rows, a rounded tint on the row that's pointed at, open or selected, and a header that sticks with a hairline under it while rows pass beneath. `dex.css` has no plain table. In a mock, use `dex-table` without the card.

## Rules

- Don't put a table in a box of its own beyond the one card.
- Cells don't wrap, so keep each one short and put a second line in a `display: block` span.
- Put the main thing in the first column in bold, with its detail under it in small muted text.
- Numbers right-aligned in `dex-num` cells, with units in the header or the cell ("£130,000"), never dollars.
