Table

SwitchTabs

Rows and columns with sorting, selection and an empty state.

0 of 5 selected
Status
INV-001Acme CorpPaid$250.00
INV-002GlobexPending$1,500.00
INV-003InitechOverdue$350.00
INV-004UmbrellaPaid$450.00
INV-005HooliPending$550.00

Installation

pnpm add krz-ui

Usage

import { Table } from "krz-ui";
<Table
  data={invoices}
  rowKey={(row) => row.id}
  selectable
  columns={[
    { key: "id", header: "Invoice", sortable: true },
    { key: "status", header: "Status", cell: (row) => <Badge>{row.status}</Badge> },
    { key: "amount", header: "Amount", sortable: true, align: "right" },
  ]}
/>

API Reference

PropTypeDescription
columnsTableColumn[]key, header, cell, sortable, sortValue, align and width.
data / rowKeyT[] / (row) => stringRows and a unique key for each.
sort / defaultSort / onSortChangeTableSort | nullControlled sort disables built-in sorting (e.g. sort on the server).
selectablebooleanAdds a checkbox column.
selectedKeys / onSelectionChangestring[]Controlled selection.
striped / compactbooleanVisual density.
emptyState / captionReactNodeShown when there's no data / under the table.
onRowClick(row) => voidMakes rows clickable.
className / style / ref—All go to the outer element. See Customization.
classNames{ table?, caption?, head?, headerCell?, sortButton?, body?, row?, cell?, empty?, select? }Extra classes for inner parts.