Tables

Basic tables

Not every list is a record screen. This is the smaller thing, and when it is the right one.

Two tables, and the choice is not close

TableDataTableRecordView
Markup you writeAll of itA columns arrayA fields array
Search and sortNoYesYes
FiltersNoNoPer column
Create and editNoNoYes
Import and exportNoNoYes
TierFreeFreePro

Use the plain table when the data is not records

A pricing comparison, a specification, a summary beside a chart. Content that happens to be tabular, where search and pagination would be furniture nobody uses.

a plain table
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow }
  from "@viliha/vui-react/table";

<Table>
  <TableHeader>
    <TableRow><TableHead>Plan</TableHead><TableHead>Seats</TableHead></TableRow>
  </TableHeader>
  <TableBody>
    {PLANS.map((p) => (
      <TableRow key={p.name}>
        <TableCell>{p.name}</TableCell>
        <TableCell>{p.seats}</TableCell>
      </TableRow>
    ))}
  </TableBody>
</Table>

⚠️ A wide table must scroll inside itself

Put it in a container with overflow-x-auto. Without one the page scrolls sideways, which moves the sidebar and the header with it.

When it did not work

Cause: this is a record list after all. Fix: move to DataTable, or RecordView if it also needs editing. Every hour spent adding controls to the plain table is an hour spent rebuilding one of the other two, worse.