Skip to contentEnma

Components

Table

Live demo

Invoices
CustomerPlanAmountStatus
NorthwindTeam$1,240.00Paid
Acme LabsBusiness$4,800.00Overdue
InitechStarter$240.00Draft

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, numeric for tabular meta face, muted, render) and rows.
  • framed (default) wraps it in a surface card; set framed={false} when it already sits inside a card.
  • Always give a caption for 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
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue
Glass
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue
Paper
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue
Mineral
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue
Enamel
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue
Ember
Invoices
CustomerAmountStatus
Northwind$1,240.00Paid
Acme Labs$4,800.00Overdue

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

Props of TableProps
PropTypeDefaultDescription
columns requiredTableColumn<R>[]
rows requiredR[]
rowKeystring
captionstring
framedbooleantrueDraw the surface, border and shadow around the table. Default true.
classNamestring
styleReact.CSSProperties

TableColumn

Props of TableColumn
PropTypeDefaultDescription
key requiredstring
label requiredReact.ReactNode
align'start' | 'end'
numericboolean
mutedboolean
render(row: R) => React.ReactNode

↑ ↓ to move, Enter to open, Esc to close

Keyboard shortcuts

Open the command palette
Ctrl then K
Search
/
Show keyboard shortcuts
?
Close the top overlay
Esc
Go to Home
G then H
Go to Themes
G then T
Go to Playground
G then P
Go to Components
G then C
Go to Guides
G then G
Go to Samples
G then S