Table
Live demo
| Customer | Plan | Amount | Status |
|---|---|---|---|
| Northwind | Team | $1,240.00 | Paid |
| Acme Labs | Business | $4,800.00 | Overdue |
| Initech | Starter | $240.00 | Draft |
How to use it
Data tables for B2B screens: quiet headers, hairline rows, right-aligned tabular numbers.
- Provide
columns(key,label,align: 'end'for numbers,numericfor tabular meta face,muted,render) androws. framed(default) wraps it in a surface card; setframed={false}when it already sits inside a card.- Always give a
captionfor screen readers.
Do: right-align amounts, put status in a Badge. Don't: zebra stripes, vertical borders, centered numbers.
In every theme
Follows the mode picked in the header.Graphite
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Glass
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Paper
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Mineral
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Enamel
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Ember
| Customer | Amount | Status |
|---|---|---|
| Northwind | $1,240.00 | Paid |
| Acme Labs | $4,800.00 | Overdue |
Code
React
import { Badge, Table } from 'enma/react';
<Table
caption="Invoices"
rowKey="id"
columns={[
{ key: 'customer', label: 'Customer' },
{ key: 'plan', label: 'Plan', muted: true },
{ key: 'amount', label: 'Amount', align: 'end', numeric: true },
{ key: 'status', label: 'Status', render: (row) => <Badge tone={row.tone}>{row.status}</Badge> },
]}
rows={invoices}
/>Plain HTML
<div class="e-table-wrap e-sq"><table class="e-table">
<caption class="e-visually-hidden">Invoices</caption>
<thead><tr><th scope="col">Customer</th><th scope="col" class="is-end">Amount</th></tr></thead>
<tbody><tr><td>Northwind</td><td class="is-end is-num">$1,240.00</td></tr></tbody>
</table></div>Props
TableProps
| Prop | Type | Default | Description |
|---|---|---|---|
columns required | TableColumn<R>[] | ||
rows required | R[] | ||
rowKey | string | ||
caption | string | ||
framed | boolean | true | Draw the surface, border and shadow around the table. Default true. |
className | string | ||
style | React.CSSProperties |
TableColumn
| Prop | Type | Default | Description |
|---|---|---|---|
key required | string | ||
label required | React.ReactNode | ||
align | 'start' | 'end' | ||
numeric | boolean | ||
muted | boolean | ||
render | (row: R) => React.ReactNode |