Table
Full-width, collapsed borders, a heavier rule under the header row.
| Class | Does what |
|---|---|
table | Full-width table with bottom-bordered cells |
Basic
<table class="table prose">
<thead>
<tr><th>Token</th><th>Purpose</th></tr>
</thead>
<tbody>
<tr><td><code>--primary</code></td><td>The brand colour</td></tr>
<tr><td><code>--secondary</code></td><td>Links</td></tr>
<tr><td><code>--error</code></td><td>Invalid inputs</td></tr>
</tbody>
</table>
<table>
<thead>
<tr><th>Token</th><th>Purpose</th></tr>
</thead>
<tbody>
<tr><td><code>--primary</code></td><td>The brand colour</td></tr>
<tr><td><code>--secondary</code></td><td>Links</td></tr>
<tr><td><code>--error</code></td><td>Invalid inputs</td></tr>
</tbody>
</table>
Composition
Common ways to put this together with other components. The general rules are on Composition.
A table with a heading and status badges
A bordered block holds the heading and the table, and a badge marks each row's state.
<section class="card-border">
<div class="prose"><h3>Invoices</h3></div>
<table class="table">
<thead><tr><th>Month</th><th>Amount</th><th>Status</th></tr></thead>
<tbody>
<tr><td>September</td><td>$1,200</td><td><span class="badge">Paid</span></td></tr>
<tr><td>October</td><td>$1,200</td><td><span class="badge">Due</span></td></tr>
</tbody>
</table>
</section>
- Surface: a flat
.card-borderrather than a raised card, because a table is read, not picked up. - Text:
.prosesits on the heading only, so it does not add margins inside the table.
Details in a card
Labels down the left, values on the right, closing with an action.
<article class="card">
<div class="prose"><h3>Order details</h3></div>
<table class="table">
<tbody>
<tr><th>Placed</th><td>October 3</td></tr>
<tr><th>Items</th><td>2</td></tr>
<tr><th>Total</th><td>$48.00</td></tr>
</tbody>
</table>
<footer class="card-actions flex" style="justify-content: end">
<button class="btn btn-secondary">Download receipt</button>
</footer>
</article>
- Text: row headings are
thin the body, so each label is tied to its value for screen readers.