Table

A React component in Beamline's Data & tables category, in the free sample.

A native HTML table for small datasets, composed with children or driven by records; shared server paging, sorting, filters, search, stable-ID selection and retry.

Use it for

  • Small static or caller-managed tables: invoices, settings lists, open orders and positions with a row action.

Not for

  • Large, sortable, filterable or editable data (data-grid).
  • Large virtualized operational datasets: use DataGrid. Native manual fold remains available when the caller supplies TableFold replacements.

Anatomy

  • Table (wrapper: the horizontal scroller; a size container when a column declares a fold)
  • TableHeader
  • TableBody (flip: rows keep their path)
  • TableFooter
  • TableRow (a reveal host for row actions)
  • TableHead
  • TableCell
  • TableFold (folded columns' values, joined into the name cell while the room is narrow)
  • TableCaption
  • TableCell rowHeader (native row heading), label (narrow records detail)
  • Comparison pan hint and keyboard-scrollable region

Variants

  • density: compact, default, comfortable
  • layout: table, records, comparison

States

  • rest
  • row hover (hover tint arrives at once, leaves over --pui-motion-out; .reveal row actions arrive)
  • selected (data-state="selected" on the row: accent tint, 2px accent-ink edge at the inline start, ink text; row actions shown)
  • sticky header (opaque surface, its own line seam)
  • pinned first column (sticky cells keep the row's hover and selected paint)
  • folded (a column marked fold=step leaves a room narrower than the step; its values show in the name cell's TableFold at=step; the column fades back in when the room grows)
  • unmeasured cell (data-null: ink-3 dash, the caller adds "Not measured")
  • empty (the caller renders one full-width row with its message)
  • record mode: local or manual server page
  • pending/error with retained rows and explicit retry
  • records: same cells rearrange beneath their row identity at a container breakpoint; headings and controls remain associated
  • comparison: bounded horizontal pan, stable first column, visible pan instruction

Keyboard

  • Native table semantics; a row action hidden until hover shows when it holds focus

Motion

Row hover arrives at 0ms and leaves over --pui-motion-out; row actions marked .reveal arrive with it. A column coming back as the room grows, and a fold line appearing, fade in over --pui-motion-in (@starting-style); leaving is at once. With <TableBody flip>, rows marked data-flip grow in, slide to their new places and fade where they stood (useFlip). Reduced motion: places change at once; the fades keep their restrained duration.

Props

PropTypeDefaultDescription
layout"table" | "records" | "comparison"—Small-room presentation; defaults to table. Record columns with fold opt into records automatically.
foldAtTableFoldStep—Container width below which records stack; defaults to lg (32rem).
scrollLabel / panHintstring—scrollLabel: Accessible name of the comparison scroller; defaults to the table aria-label. panHint: Visible instruction for horizontal comparison.
TableCell label / rowHeaderstring / boolean—label: On TableCell: The real column heading, repeated visually above the value in narrow records. rowHeader: On TableCell: Render a native th scope=row without changing the cell presentation.
TableHead labelstring—label: On TableHead: Plain column name when the heading contains a sorting control.
density"compact" | "default" | "comfortable"—Fixed row height: 32 / 40 / 48 px. Scoped density is the fallback.
stickyHeaderboolean—Keeps table headings visible while the table scrolls. Defaults to false.
TableHead / TableCell numericboolean—Marks numeric cells for alignment and tabular figures; defaults to false on both parts.
TableHead / TableCell fold"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"—The column leaves when the table's room is narrower than this step; mark its head and every cell (a footer too, with an empty cell). Show its value in the name cell's TableFold.
TableFold at (required)"xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"—at: On TableFold: Room breakpoint below which the folded cell content appears. Required.
TableBody flipbooleanfalseflip: On TableBody: Rows marked `data-flip={id}` keep their path: a new row grows in, the rest slide to their places, a removed one fades where it stood. Off by default (a cell's own animated content stays its own).
rowHeightnumber—Explicit geometry overrides scoped tokens and density.
classNamesPartial<Record<"root" | "header" | "row" | "footer" | "wrap" | "body" | "caption" | "he…—Classes for the named visual parts; no part overrides by default.
TableBody.flipboolean—On TableBody: Rows marked `data-flip={id}` keep their path: a new row grows in, the rest slide to their places, a removed one fades where it stood. Off by default (a cell's own animated content stays its own).
TableCell.numericboolean—On TableCell: Right-aligns tabular numeric content. Defaults to false.
TableCell.foldTableFoldStep—On TableCell: Leave the row when the table's room is narrower than this step (mark the column's TableHead the same); show its value in the name cell's `<TableFold at>` instead.
TableCell.interactiveboolean—On TableCell: The caller's native button fills the cell and uses an inset keyboard focus ring.
TableCell.stickyboolean—On TableCell: Pin the first column to the logical start edge.
TableHead.numericboolean—On TableHead: Right-aligns tabular numeric content. Defaults to false.
TableHead.stickyboolean—On TableHead: Keeps this table cell pinned at the inline start. Defaults to false.
TableHead.foldTableFoldStep—On TableHead: Room breakpoint below which this column folds; omitted by default to keep the column visible.
TableFold.at (required)TableFoldStep—On TableFold: Room breakpoint below which the folded cell content appears. Required.
dataT[]—Optional record mode; omit to keep composing TableHeader/TableBody children.
columnsTableColumn<T>[]—
getRowId((row: T) => string)—Required for record mode: stable IDs, never page indices.
onRowClick((row: T) => void)—
toolbarboolean—Record-mode search and column filters. Default true.
labelstring—On TableHead / TableCell: Plain column name when the heading contains a sorting control.
manualboolean—Server owns ordering, filters, search and page slicing. Default false.
sortListSort—
defaultSortListSort—
onSortChange((sort: ListSort) => void)—
filtersListFilters—
defaultFiltersListFilters—
onFiltersChange((filters: ListFilters) => void)—
querystring—
defaultQuerystring—
onQueryChange((query: string) => void)—
selectedstring[]—Stable row IDs, retained across server pages.
defaultSelectedstring[]—
onSelectedChange((ids: string[]) => void)—
selectableboolean—
loadingboolean—
errorReactNode | Error—Errors retain the last completed rows. Error objects are rendered by their message.
onRetry(() => void | Promise<unknown>)—
emptyLabelstring—
allowSelectAllMatchingboolean—
onSelectAllMatching((scope: { rowCount: number; query: string; filters: ListFilters; }) => void)—
paginationboolean—Enable page controls explicitly. Page-related props also enable them, unless onEndReached is supplied.
pagenumber—One-based requested page. Default 1.
defaultPagenumber—
onPageChange((page: number) => void)—
pageSizenumber—Positive rows per page. Default 25.
defaultPageSizenumber—
onPageSizeChange((pageSize: number) => void)—
rowCountnumber | null—Total matching rows on the server. null means unknown. Local grids calculate it before slicing.
totalnumber | null—Deprecated: Use rowCount. Canonical rowCount wins, including null.
onEndReached(() => void | Promise<unknown>)—Append mode: fetch another batch. The app appends it to the supplied rows.
hasMoreboolean—Whether another batch exists; defaults to true with onEndReached. False stops requests.
loadingMoreboolean—An append request is pending; retain every loaded row.
scrollLabelstring—Accessible name of the comparison scroller; defaults to the table aria-label.
panHintstring—Visible instruction for horizontal comparison.
TableCell.rowHeaderboolean—On TableCell: Render a native th scope=row without changing the cell presentation.

Built from

Used in

Import

import { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead } from "@beamline/table";

Get it

Table is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Table is included in the free MIT sample. Get Beamline · Connect your agent

More in Data & tables

  • Living table: A table that shows as much as fits on both axes: width decides which columns show (the rest ride in the name line, moving there rather than vanishing)…
  • Availability layers: A week of bookable start times whose closed times explain themselves: every availability rule (hours, time off, bookings, buffers, rooms, lead time…
  • Capacity terrain: A schedule that stands on a terrain of capacity: under each station's lane of jobs, every day's load rises to its capacity line and an overload is a…
  • Domino move: A room board where one move shows its chain: drag a booking (or pick it and aim it with the keys) onto a taken room and the bookings it would push appear…
  • Match board: Month-end matching as one picture: bank lines and books entries side by side with threads between them — solid for matched, dashed with the host's reason…
  • Split anything: One splitter for money, quantities and time: a bar of the whole shows every target's part and what is not split yet; items are dragged onto targets…
  • Approval route: A policy you can read by trying it: an amount on a log scale with the thresholds as marks (the arrows stop just under, at and just over each), the…
  • Proposal twin: A proposal edited beside the client's exact page, the two linked both ways: a field in focus lights its twin on the page, scrolls it into view and joins…
  • Quantity river: The life of one order line's quantity: at rest a bar of its real split ("5 delivered · 1 back in stock · 1 damaged · 5 cancelled"), unfolding into a…
  • Stock horizon: Projected stock per item over the coming weeks: a strip of weeks with the safety line, weeks under safety in warn and short in danger, every dip said in…
  • Ageing queue: Tickets that visibly age: each ticket's ring fills toward its own service target and steps from on time to late to very late, the words say when it is…
  • Import lens: A messy import made fixable by kind: rows stream through the checks once with live counts; problems gather into groups that say what is wrong in words…
  • Duplicate guard: A new record that watches for the one that already exists: as you type, the likely duplicates slide in beside the form with the fields that match lit and…
  • Scan flow: A pick list that takes scans: each scan flies from the scan field into its row and fills that row's quantity ring, and the prompt moves to the next bin…
  • Pack planner: The packing bench: the order's items sit in box outlines drawn to scale, each box filling to its padding line, weighing against its limit and naming the…
  • Provenance lens: Hold Alt (or press Lens) over any number on the page and see what makes it: hairline threads draw from the number to the rows, cards and documents on…
  • Record time machine: The record itself, rewound in place: a slim track of every change (a tick per change in its person's colour, hollow for automation, named moments as…
  • Tension timeline: A plan where slack is something you see: every dependency is a string from one task's end to the next one's start, sagging with the days it has to spare…
  • Replay bar: Rewind for anything live: pause a stream, scrub back to the moment you missed (markers for the ones that matter), step one update at a time, replay at a…
  • Event calendar: A schedule of events by day, week or month: events that overlap sit side by side, drag one to another time or day or pull its bottom edge to change its…
  • Kanban board: Work as cards in columns by stage: drag a card (or lift it with Space and walk it with the arrows) to another column or place, the cards around it make…
  • Data grid: Virtualised local or server-driven grid: stable row IDs, manual sort and filters, pages or infinite loading, retry without losing rows, inline editing…
  • Pivot table: Records summed up by the fields people choose: rows grouped by one or more fields that fold open level by level, columns split by another, one or more…
  • Query builder: Conditions people build by hand to pick out records: each rule is a field, an operator that fits the field (contains, between, in the last N days, is any…
  • Sort order: Several sort keys in order. Each key says its rank in words ("Sort by Plan, A to Z", "then by Size, largest first") with its order named for the field's…
  • Metric rules: Ordered rules that colour a dashboard number. Each rule has a name for what its colour means ("At risk", not just red) and a tone (good, watch, act…
  • Log viewer: Log lines as they stream: it follows the newest line until you scroll up, then counts what arrived and brings you back in one click; filter by level with…
  • JSON viewer: A JSON value as a tree you can read and walk: branches open and close (one level, or all at once), closed ones preview what they hold, every value reads…
  • JSON diff viewer: Two versions of a JSON value compared as one tree: added keys marked +, removed ones struck through with −, changed values read old → new, unchanged keys…
  • Import mapping: Map the columns of a file to the fields of one record type, see what every value becomes, then run the import and get an outcome for each row…
  • Diff table: Proposed edits to a table before they happen: new rows green, removals struck through, changed cells old → new; each change can be left out and Apply…
  • Filter toolbar: The filters on a list kept in view: chips that remove themselves, Add filter with fields and their values, Clear all, and room for search or view controls.

Guides: Build a data grid and CRM screen in React

Compared in: Beamline UI and Kobra: interaction design and app screens

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.