Components/Table

Table

Composable table primitives — header, body, footer, rows, cells, caption. Everything else (sorting, filtering, pagination, selection, virtualization) is built on top with regular React patterns. The primitives don't impose state; you bring your own.


A list of your recent invoices.
InvoiceClientMethodAmount
INV-101Globex CorpCard$1,240
INV-102InitechPix$840
INV-103Soylent LtdBank$3,120
INV-104Umbrella Co.Card$210
INV-105Acme BankBank$12,480
Total$17,890

Installation

npx ajaxui add table

Sortable columns

Click a column header to sort ascending; click again to reverse. The active column shows a directional caret; inactive columns show a subtle stacked arrows hint. Pure useState — no library.

INV-1012026-05-12Globex Corp$1,240
INV-1022026-05-11Initech$840
INV-1032026-05-09Soylent Ltd$3,120
INV-1042026-05-08Umbrella Co.$210
INV-1052026-05-07Acme Bank$12,480
INV-1062026-05-04Stark Ind.$5,400
INV-1072026-05-03Wonka Co.$98

Filter + search

Search input over title fields plus a chip-bar status filter. Filters compose — the empty-state row is the only fallback you need.

InvoiceClientStatusAmount
INV-101Globex CorpPaid$1,240
INV-102InitechPending$840
INV-103Soylent LtdOverdue$3,120
INV-104Umbrella Co.Paid$210
INV-105Acme BankDraft$12,480
INV-106Stark Ind.Paid$5,400
INV-107Wonka Co.Pending$98
INV-108Wayne Ent.Overdue$9,210
INV-109Pied PiperPaid$320
INV-110Hooli Inc.Paid$4,180
INV-111Massive Dyn.Pending$2,640
INV-112Tyrell CorpDraft$6,800

Pagination

Slice your rows by page-size and pair the table with a pagination control. Track the page in local state for client-side data, or fetch per page for server-side.

InvoiceClientStatusAmount
INV-101Globex CorpPaid$1,240
INV-102InitechPending$840
INV-103Soylent LtdOverdue$3,120
INV-104Umbrella Co.Paid$210
INV-105Acme BankDraft$12,480

Showing 15 of 12

Selection + bulk actions

Per-row checkboxes plus a tri-state header (all / some / none) and a contextual action bar that surfaces when anything is selected. Track the selected ids in a Set.

InvoiceClientStatusAmount
INV-101Globex CorpPaid$1,240
INV-102InitechPending$840
INV-103Soylent LtdOverdue$3,120
INV-104Umbrella Co.Paid$210
INV-105Acme BankDraft$12,480
INV-106Stark Ind.Paid$5,400

Notes

Anatomy

<Table>
  <TableCaption/>      // optional title shown below the table
  <TableHeader>
    <TableRow>
      <TableHead/>     // <th>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell/>     // <td>
    </TableRow>
  </TableBody>
  <TableFooter>       // optional total row
    <TableRow>
      <TableCell/>
    </TableRow>
  </TableFooter>
</Table>

For pre-built sort + pagination + column filters in one component, see Data Table.

Props

PropTypeDefaultDescription
(no props)Each sub-component is a styled <table>/<tr>/<td> with className passthrough.
classNamestring (on every subcomponent)Tailwind classes — merged with the defaults.