Skip to content
v0.2.10

DataTable

A native data table with local sorting, page-scoped selection and pagination.

Preview
Projects
Design systemActive12
WebsiteActive4
Agent guidesDraft2
Mobile appDraft8
ResearchArchived3

Use DataTable

DataTable is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
data-table.tsxTSX
"use client";

import { FloodRoot, DataTable } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <DataTable caption="Projects" selectable pageSize={5}
        columns={[{id:"name",label:"Project",sortable:true},{id:"status",label:"Status"}]}
        rows={[{id:"design",label:"Design system",cells:{name:"Design system",status:"Active"}}]} />
    </FloodRoot>
  );
}

Design notes

  • Supply the complete client collection; remote/server pagination and virtualization are not part of this API.
  • Select all affects selectable rows on the current page and preserves selection on other pages.
  • Use sortValues for rich React cells; missing values sort last in both directions.

API reference

PropValuesDefault
captionstringRequired
hideCaptionboolean—
columnsreadonly DataTableColumn[]Required
rowsreadonly DataTableRow[]Required
density"compact" | "comfortable"—
stripedboolean—
minWidthCSSProperties["minWidth"]—
sortDataTableSort | null—
defaultSortDataTableSort | null—
onSortChange(sort: DataTableSort | null) => void—
localestring—
selectableboolean—
selectedIdsreadonly string[]—
defaultSelectedIdsreadonly string[]—
onSelectionChange(ids: string[]) => void—
pagenumber—
defaultPagenumber—
pageSizenumber—
onPageChange(page: number) => void—
state"ready" | "loading" | "error"—
onRetry() => void—
labelsDataTableLabels—
Native HTML propsOmit<HTMLAttributes<HTMLDivElement>, "children">Forwarded
View TypeScript source