Design System/Atoms/Data Table

Data Table

A generic, sortable, filterable, and paginated data table built on @tanstack/react-table v8. Define typed columns once and pass any data.

When To Use

  • Use Data Table when information needs to be scanned quickly and compared across multiple rows, cards, or values.
  • Choose the example that best matches whether the user is browsing, monitoring, or drilling into structured data.
  • Lean on these patterns when you want consistent spacing and hierarchy before tuning the visual treatment.

When Not To Use

  • Do not use a dense data pattern when the primary task is storytelling, onboarding, or one-off explanation.
  • Do not flatten nuanced data into a compact summary card if the user still needs the underlying structure to make a decision.

Accessibility Notes

  • Preserve table semantics for tabular data and avoid flattening structured information into generic divs.
  • Use clear headings, summaries, and labels so assistive technologies can announce the data in context.
  • Do not rely on color alone to communicate trend, status, or state in charts and metric cards.

Key Props / API

Props

columns, data, searchKey, searchPlaceholder, pageSize, showPagination

Example Code

import { DataTable, createColumnHelper, type ColumnDef } from "@hilum/ui"
import { Badge } from "@hilum/ui"

type Transaction = {
  id: string; company: string; type: string
  amount: string; date: string; status: "Paid" | "Pending" | "Overdue"
}

const helper = createColumnHelper<Transaction>()

const columns: ColumnDef<Transaction>[] = [
  helper.accessor("id", {
    header: "ID",
    cell: (info) => <span className="font-mono caption text-ground-400">{info.getValue()}</span>,
  }),
  helper.accessor("company", {
    header: "Company",
    cell: (info) => <span className="font-medium text-ground-900">{info.getValue()}</span>,
// ...trimmed for docs

With search

Search and sort

Filter rows by company name, click column headers to sort

TXN-8821Acme CorpInvoice$4,200Apr 1, 2026Paid
TXN-8820Globex Inc.Invoice$1,900Mar 28, 2026Pending
TXN-8819Initech LLCRefund$320Mar 22, 2026Paid
TXN-8818Umbrella CorpInvoice$8,750Mar 15, 2026Overdue
TXN-8817Soylent CorpInvoice$2,100Mar 10, 2026Paid

12 results

Page 1 of 3

Without search

Sort and paginate

All sorting and pagination controls, without the search input

TXN-8821Acme CorpInvoice$4,200Apr 1, 2026Paid
TXN-8820Globex Inc.Invoice$1,900Mar 28, 2026Pending
TXN-8819Initech LLCRefund$320Mar 22, 2026Paid
TXN-8818Umbrella CorpInvoice$8,750Mar 15, 2026Overdue
TXN-8817Soylent CorpInvoice$2,100Mar 10, 2026Paid

12 results

Page 1 of 3

Custom columns

Simplified view with actions

Four-column layout with a ghost action button per row

Actions
Acme Corp$4,200Paid
Globex Inc.$1,900Pending
Initech LLC$320Paid
Umbrella Corp$8,750Overdue
Soylent Corp$2,100Paid

12 results

Page 1 of 3