Meowland docs
Workbench

Component reference

Table

Data table.

Preview

Sort, resize and select

A data table of host records. Column headers sort; their edges resize; checkboxes select several rows. The caller still owns the row order.

packages/meowtail/stories/table.stories.tsxline 47tsx
render: () => {
  const sort = signal<TableSort | undefined>({ columnId: "name", direction: "asc" });
  const selected = signal<readonly string[]>(["alpha"]);
  const rows = mapSignal(sort, rowsFor);
  return (
    <Stack>
      <Table
        label="Workspace files"
        selectable
        columns={[
          { id: "name", header: "Name", sortable: true, width: 180 },
          { id: "kind", header: "Kind", sortable: true, width: 140 },
          { id: "size", header: "Size", sortable: true, align: "end", width: 88 },
        ]}
        rows={rows}
        sort={sort}
        onSortChange={(next) => {
          sort.value = next;
        }}
        selected={selected}
        onSelectedChange={(ids) => {
          selected.value = ids;
        }}
      />
      <Note role="status">
        {mapSignal(selected, (ids) =>
          ids.length === 0 ? "No files selected." : `Selected: ${ids.join(", ")}.`,
        )}
      </Note>
    </Stack>
  );
}

Installation

bun add meowtail

Usage

usage.tsts
import { Table } from "meowtail";

API reference

Sorting and selection are reported; row order and records stay with the caller.

Props

PropTypeDefault
labelRequired
string–
columnsRequired
readonly TableColumn[]–
rowsRequired
MaybeSignal<readonly TableRow[]>–
sort
MaybeSignal<TableSort | undefined>–
defaultSort
TableSort–
onSortChange
(sort: TableSort) => void–
selected
MaybeSignal<readonly string[]>–
defaultSelected
readonly string[][]
onSelectedChange
(ids: readonly string[]) => void–
selectable
booleanfalse

Also takes className, children and the attributes and events of its root element.

DOM parts

rootscrollertableheaderheadingsortresizebodyrowcellselect

Registry

The component is registered as table in the meowtail component registry.