DataTable
Render application data with the portable data-table contract.
Overview
DataTable renders a small, rectangular snapshot of display-ready text as a native table. It does not fetch data or infer formatting, sorting, filtering, pagination, selection, actions, or row state.
Use when
You have a small, bounded snapshot of read-only display text with column headers.
Use instead
Use Table parts when data needs links, controls, rich formatting, sorting, filtering, pagination, selection, or application-owned row state.
Usage
| Project | Status |
|---|---|
| Atlas | Active |
| Beacon | Planned |
import { DataTable } from "@smoothie-framework/whisk-react";
<DataTable
caption="Open projects"
columns={["Project", "Status"]}
rows={[
{ cells: ["Atlas", "Active"] },
{ cells: ["Beacon", "Planned"], emphasized: true },
]}
/>Examples
Pass display-ready text
DataTable accepts strings, not records, formatters, or cell renderers. Format values before creating the rectangular rows, then preserve the same order as the column labels.
| Project | Published | Bundle size |
|---|---|---|
| Atlas | 14 Oct 2026 | 12.4 MB |
| Beacon | 10 Oct 2026 | 8.1 MB |
import { DataTable } from "@smoothie-framework/whisk-react";
const releaseRows = [
{ cells: ["Atlas", "14 Oct 2026", "12.4 MB"] },
{ cells: ["Beacon", "10 Oct 2026", "8.1 MB"], emphasized: true },
];
<DataTable
caption="Recent releases"
columns={["Project", "Published", "Bundle size"]}
rows={releaseRows}
striped
/>Keep an empty result truthful
An empty rows array is valid. DataTable keeps the caption and headers but does not invent an empty-state message or action; use Table parts and surrounding application UI when people need recovery or next steps.
| Environment | Version | Published |
|---|
import { DataTable } from "@smoothie-framework/whisk-react";
<DataTable
caption="Deployment history"
columns={["Environment", "Version", "Published"]}
rows={[]}
/>Contain a wide direct table
DataTable does not choose a scroll container. Wrap a direct wide table in TableScrollArea so essential columns remain available, and name that scroll region when its purpose is not already obvious.
import { DataTable, TableScrollArea } from "@smoothie-framework/whisk-react";
<TableScrollArea frame="outline" aria-label="Project audit history">
<DataTable
caption="Project audit history"
columns={["Project", "Actor", "Event", "Source", "Time"]}
rows={[
{ cells: ["Atlas", "Rosa", "Published", "CLI", "14 Oct, 14:32"] },
]}
style={{ minWidth: "48rem" }}
/>
</TableScrollArea>Use Table for rich or interactive cells
DataTable has no cell renderer, children, actions, or sort state. Switch to Table parts when a cell needs a link, button, badge, formatted value, row header, or other application-owned behavior.
import {
Button,
Table,
TableBody,
TableCaption,
TableCell,
TableColumnHeader,
TableHeader,
TableRow,
} from "@smoothie-framework/whisk-react";
<Table>
<TableCaption side="top">Projects</TableCaption>
<TableHeader>
<TableRow>
<TableColumnHeader>Project</TableColumnHeader>
<TableColumnHeader>Actions</TableColumnHeader>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Atlas</TableCell>
<TableCell><Button size="sm" variant="secondary">Open project</Button></TableCell>
</TableRow>
</TableBody>
</Table>Props
Component props
Accessibility
DataTable renders an ordinary native table with a top caption and scoped column headers. Make the caption and labels understandable out of context, and keep their order aligned with every row. It does not add a live region, keyboard navigation, sort state, or an empty-state message. Empty rows render a valid table with no data cells. For a wide direct DataTable, wrap it in a named TableScrollArea; the catalog renderer adds that wrapper automatically. Use Table parts when a relationship needs row headers, rich cells, controls, or interactive data-grid behavior.
Content guidance
Write the caption and column labels so the data makes sense when read out of context. Keep cell values short and use a regular Table when cells need richer content.