Skip to content

Table

Rows of the same kind of thing, lined up in columns so they can be compared. On a phone each row becomes a card: the first column is the card’s title and every other value carries the name of its column, so nothing ever scrolls sideways. When there are more rows than fit on a page, it paginates.

import { Table, TableSkeleton } from '@sypnia/ui/react'

On this page
  1. Sorting
  2. Pages: 60 rows, 10 at a time
  3. Loading
  4. Something failed
  5. Empty, with the next step
  6. Actions on each row
  7. Skeleton
  8. When to use it
  9. For everyone
  10. Props

Sorting

Press «Customer» or «Total». Numbers and dates are written in the language of the page.

1042Laura MéndezPaidNov 16, 2026$128.40
1041Diego RuizPendingNov 16, 2026$42.00
1040Ana CastañoPaidNov 15, 2026$310.95
1039Marco SilvaRefundedNov 14, 2026$18.50
1038Julia PrietoPaidNov 12, 2026$96.00
Code
import { Badge, Table, useSypnia, type Column } from '@sypnia/ui/react';

interface Order { id: string; customer: string; total: number; status: 'Paid' | 'Pending' | 'Refunded'; placed: string }
const orders: Order[] = [
  { id: '1042', customer: 'Laura Méndez', total: 128.4, status: 'Paid', placed: '2026-11-16' },
  { id: '1041', customer: 'Diego Ruiz', total: 42, status: 'Pending', placed: '2026-11-16' },
  { id: '1040', customer: 'Ana Castaño', total: 310.95, status: 'Paid', placed: '2026-11-15' },
  { id: '1039', customer: 'Marco Silva', total: 18.5, status: 'Refunded', placed: '2026-11-14' },
  { id: '1038', customer: 'Julia Prieto', total: 96, status: 'Paid', placed: '2026-11-12' },
];
const tone = { Paid: 'ok', Pending: 'warn', Refunded: 'fail' } as const;

// Press a column name to sort: once ascending, twice descending, three times back to the original order.
export default function Basic() {
  const { format } = useSypnia();
  const columns: Column<Order>[] = [
    { id: 'id', header: 'Order', cell: (o) => o.id, sortValue: (o) => o.id },
    { id: 'customer', header: 'Customer', cell: (o) => o.customer, sortValue: (o) => o.customer },
    { id: 'status', header: 'Status', cell: (o) => <Badge tone={tone[o.status]} dot>{o.status}</Badge>, sortValue: (o) => o.status },
    { id: 'placed', header: 'Placed', cell: (o) => format.date(o.placed), sortValue: (o) => o.placed },
    { id: 'total', header: 'Total', numeric: true, cell: (o) => format.currency(o.total, 'USD'), sortValue: (o) => o.total },
  ];
  return <Table label="Orders" columns={columns} rows={orders} rowKey={(o) => o.id} />;
}

Pages: 60 rows, 10 at a time

The bar under the rows says which ones are on screen and lets the person choose how many per page.

Status
1042Laura MéndezPaid$12.00
1041Iván PeñaPaid$49.13
1040Julia PrietoPaid$86.26
1039Diego RuizRefunded$123.39
1038Clara OssaPending$160.52
1037Tomás VeraPaid$197.65
1036Ana CastañoPaid$234.78
1035Felipe ReyPaid$271.91
1034Sara LozanoRefunded$18.04
1033Marco SilvaPending$55.17
1–10 of 60
Code
import { Badge, Table, useSypnia, type Column } from '@sypnia/ui/react';

const names = ['Laura Méndez', 'Diego Ruiz', 'Ana Castaño', 'Marco Silva', 'Julia Prieto', 'Tomás Vera', 'Sara Lozano', 'Iván Peña', 'Clara Ossa', 'Felipe Rey'];
const states = ['Paid', 'Paid', 'Pending', 'Paid', 'Refunded'] as const;
const tone = { Paid: 'ok', Pending: 'warn', Refunded: 'fail' } as const;
// 60 orders, made up but always the same.
const orders = Array.from({ length: 60 }, (_, i) => ({
  id: String(1042 - i), customer: names[(i * 7) % names.length], status: states[(i * 3) % states.length], total: 12 + ((i * 37) % 290) + ((i * 13) % 100) / 100,
}));
type Order = (typeof orders)[number];

// With pageSize the table paginates by itself. Sorting sorts all 60 rows, not only the ones in view.
export default function Paginated() {
  const { format } = useSypnia();
  const columns: Column<Order>[] = [
    { id: 'id', header: 'Order', cell: (o) => o.id, sortValue: (o) => Number(o.id) },
    { id: 'customer', header: 'Customer', cell: (o) => o.customer, sortValue: (o) => o.customer },
    { id: 'status', header: 'Status', cell: (o) => <Badge tone={tone[o.status]} dot>{o.status}</Badge> },
    { id: 'total', header: 'Total', numeric: true, cell: (o) => format.currency(o.total, 'USD'), sortValue: (o) => o.total },
  ];
  return <Table label="Orders" columns={columns} rows={orders} rowKey={(o) => o.id} pageSize={10} />;
}

Loading

As many skeleton rows as will come, with the real columns and each cell the size of its value, for about two seconds. Press «Load again» to see it once more.

Team
NameEmailRole
Code
import { useEffect, useState } from 'react';
import { Badge, Button, SkeletonOf, SkeletonWords, Table, type Column } from '@sypnia/ui/react';

interface Member { name: string; email: string; role: string }
const team: Member[] = [
  { name: 'Laura Méndez', email: 'laura@northwind.io', role: 'Owner' },
  { name: 'Diego Ruiz', email: 'diego@northwind.io', role: 'Editor' },
  { name: 'Ana Castaño', email: 'ana@northwind.io', role: 'Viewer' },
];
// Each column says what its cells look like while loading: a typical value as SkeletonWords, the real Badge as SkeletonOf.
const columns: Column<Member>[] = [
  { id: 'name', header: 'Name', cell: (m) => m.name, skeleton: (i) => <SkeletonWords>{['Laura Méndez', 'Diego Ruiz', 'Ana Castaño'][i % 3]}</SkeletonWords> },
  { id: 'email', header: 'Email', cell: (m) => m.email, skeleton: <SkeletonWords>diego@northwind.io</SkeletonWords> },
  { id: 'role', header: 'Role', cell: (m) => <Badge>{m.role}</Badge>, skeleton: <SkeletonOf><Badge>Editor</Badge></SkeletonOf> },
];

// While the rows are on their way, the table draws as many skeleton rows as will come (loadingRows: the count of the last
// visit, a known total) with its real columns, each cell the size of its value. Press «Load again»: nothing moves.
export default function Loading() {
  const [rows, setRows] = useState<Member[]>();
  useEffect(() => { if (!rows) { const t = setTimeout(() => setRows(team), 2500); return () => clearTimeout(t); } }, [rows]);
  return (
    <Table label="Team members" columns={columns} rows={rows} rowKey={(m) => m.email} loading={!rows} loadingRows={team.length}
      toolbar={<><span className="sy-text--sm sy-text--strong">Team</span><Button size="sm" disabled={!rows} onClick={() => setRows(undefined)}>Load again</Button></>} />
  );
}

Something failed

What happened, in words, and «Try again». Press it.

Code
import { useState } from 'react';
import { Table, type Column } from '@sypnia/ui/react';

interface Invoice { id: string; month: string; amount: string }
const invoices: Invoice[] = [
  { id: 'INV-0011', month: 'November 2026', amount: 'US$ 49.00' },
  { id: 'INV-0010', month: 'October 2026', amount: 'US$ 49.00' },
];
const columns: Column<Invoice>[] = [
  { id: 'id', header: 'Invoice', cell: (i) => i.id },
  { id: 'month', header: 'Month', cell: (i) => i.month },
  { id: 'amount', header: 'Amount', numeric: true, cell: (i) => i.amount },
];

// The error takes the place of the rows and offers to try again. Press it: skeleton first, then the rows.
export default function Failed() {
  const [state, setState] = useState<'failed' | 'loading' | 'ready'>('failed');
  const retry = () => { setState('loading'); setTimeout(() => setState('ready'), 1800); };
  return (
    <Table label="Invoices" columns={columns} rowKey={(i) => i.id}
      rows={state === 'ready' ? invoices : undefined} loading={state === 'loading'}
      error={state === 'failed' ? 'The invoices could not be loaded. The billing service did not answer.' : undefined} onRetry={retry} />
  );
}

Empty, with the next step

What goes here and the button that adds the first one.

No webhooks yet

A webhook tells your server the moment something changes, so it does not have to keep asking.
Code
import { useState } from 'react';
import { Button, EmptyState, Table, type Column } from '@sypnia/ui/react';

interface Hook { url: string; event: string }
const columns: Column<Hook>[] = [
  { id: 'url', header: 'Address', cell: (h) => <span className="sy-machine">{h.url}</span> },
  { id: 'event', header: 'When', cell: (h) => h.event },
];

// An empty table says what goes in it and offers the first step. Press «Add a webhook».
export default function Empty() {
  const [hooks, setHooks] = useState<Hook[]>([]);
  return (
    <Table label="Webhooks" columns={columns} rows={hooks} rowKey={(h) => h.url}
      empty={
        <EmptyState icon="link" title="No webhooks yet"
          actions={<Button variant="primary" icon="plus" onClick={() => setHooks([{ url: 'https://northwind.io/hooks/orders', event: 'An order is paid' }])}>Add a webhook</Button>}>
          A webhook tells your server the moment something changes, so it does not have to keep asking.
        </EmptyState>
      } />
  );
}

Actions on each row

A common action as an icon, the rest in a menu, and the destructive one behind a confirmation.

API keys
KindLast usedActions
Back officeSecretToday
Mobile appPublicToday
Old websitePublicMarch 2
Code
import { useState } from 'react';
import { Badge, Button, ConfirmDialog, IconButton, Menu, MenuItem, Table, toast, Toaster, type Column } from '@sypnia/ui/react';

interface Key { id: string; name: string; kind: 'Secret' | 'Public'; used: string }
const start: Key[] = [
  { id: 'key_1', name: 'Back office', kind: 'Secret', used: 'Today' },
  { id: 'key_2', name: 'Mobile app', kind: 'Public', used: 'Today' },
  { id: 'key_3', name: 'Old website', kind: 'Public', used: 'March 2' },
];

// The last column holds the actions of each row. On a phone they go to the foot of the card.
export default function RowActions() {
  const [keys, setKeys] = useState(start);
  const [doomed, setDoomed] = useState<Key | null>(null);
  const columns: Column<Key>[] = [
    { id: 'name', header: 'Name', cell: (k) => k.name, sortValue: (k) => k.name },
    { id: 'kind', header: 'Kind', cell: (k) => <Badge outline>{k.kind}</Badge> },
    { id: 'used', header: 'Last used', cell: (k) => k.used },
    { id: 'actions', header: 'Actions', actions: true, cell: (k) => (
      <>
        <IconButton icon="copy" label={`Copy the ID of ${k.name}`} onClick={() => { void navigator.clipboard?.writeText(k.id); toast('ID copied'); }} />
        <Menu trigger={<IconButton icon="more" label={`More actions for ${k.name}`} tooltip={false} />}>
          <MenuItem icon="edit" onAction={() => toast(`Rename ${k.name}`, { tone: 'info' })}>Rename</MenuItem>
          <MenuItem icon="trash" danger onAction={() => setDoomed(k)}>Revoke key</MenuItem>
        </Menu>
      </>
    ) },
  ];
  return (
    <>
      <Table label="API keys" columns={columns} rows={keys} rowKey={(k) => k.id}
        toolbar={<><span className="sy-text--sm sy-text--strong">API keys</span><Button size="sm" onClick={() => setKeys(start)}>Restore the keys</Button></>} />
      <ConfirmDialog open={doomed !== null} onClose={() => setDoomed(null)} title={`Revoke the key ${doomed?.name}?`} action="Revoke key"
        onConfirm={() => { setKeys(keys.filter((k) => k !== doomed)); setDoomed(null); toast('Key revoked'); }}>
        Apps that use it stop working at once. This cannot be undone.
      </ConfirmDialog>
      <Toaster />
    </>
  );
}

Skeleton

Before even the columns are known: the same boxes as the real one, so nothing moves when the data arrives. On a phone, cards.

Code
import { TableSkeleton } from '@sypnia/ui/react';

// Before even the columns are known: header, rows and the pagination bar, in the boxes of a real Table.
// On a phone it is cards, like the real one. When the columns are known, use <Table loading> instead.
export default function Skeleton() {
  return <TableSkeleton columns={4} rows={5} pagination />;
}

When to use it

Use it when

  • Many things of one kind with the same facts: orders, members, keys, invoices.
  • People compare down a column or look for one row: make those columns sortable with sortValue.
  • Give it pageSize and it paginates by itself; with pages that come from a server, pass pagination.
  • Put the column that names the row first: on phones it is the title of the card.

Do not use it when

  • The things are few and each has a different shape: Cards.
  • It is facts about a single thing: KeyValue.
  • Cells must be edited in place, columns resized or thousands of rows scrolled: DataTable.
  • You would use it to lay out a page. A table is for data.

For everyone

  • It is a real table with a name (label), column headers and rows, so screen readers announce «Total, column 5» as the person moves.
  • A sortable header is a button named «Sort by Total»; the column says whether it is sorted ascending or descending. Empty values go last in both directions.
  • On phones (40rem and below) every row is a card and each value shows its column name beside it; the header row stays available to screen readers. Row actions go to the foot of the card, as targets of at least 44 px.
  • While loading, the table is marked busy and draws skeleton rows: no spinner. An error is announced at once and offers «Try again». An empty table says what goes in it.
  • Under the rows, the pagination bar says how many there are and which ones are on screen, and announces it after each move.
  • Action buttons need a name that includes the row: «Copy the ID of Back office».

Props

TableTypeDefault
columnsrequired Column<Row>[]
labelrequired

A name for screen readers.

string
rowKeyrequired (row: Row) => string | number
rowsrequired Row[] | undefined
dense boolean
empty

What to show when there are no rows: an EmptyState with the next step.

ReactNode
error

Something failed: the region says so. Say what happened in plain words.

ReactNode
loading

Data is on its way: rows are drawn as skeletons of the right shape.

boolean
loadingRows

How many skeleton rows to draw while loading: as many as will come (the count of the last visit, a known total). Default 6, never more than a page.

number
onRetry

With `error`: shows a «Try again» button that calls it.

(() => void)
onRowClick ((row: Row) => void)
pageSize

Rows per page, 25 by default: every table paginates by itself. For server-side pages pass `pagination` instead.

number
pagination

Server-side pagination: the table shows `rows` as they are and this bar under them.

{ page: number; pageSize: number; total: number; onPage: (p: number) => void; onPageSize?: ((s: number) => void); }
toolbar ReactNode
TableSkeletonTypeDefault
columns number 4
dense boolean
pagination boolean
rows number 6
  1. Sorting
  2. Pages: 60 rows, 10 at a time
  3. Loading
  4. Something failed
  5. Empty, with the next step
  6. Actions on each row
  7. Skeleton
  8. When to use it
  9. For everyone
  10. Props

    Search pages, sections and terms