40+ landing page components for ReactBrowse now

Primitives

Table

Data table component for displaying structured information in rows and columns. Supports striped rows, hover highlighting, sortable columns, and compact mode.

Live Demo

Interactive Table (click headers to sort)

NameEmailRoleStatus
Alice Johnsonalice@example.comDeveloperActive
Bob Smithbob@example.comDesignerActive
Carol Williamscarol@example.comManagerAway
Dave Browndave@example.comDeveloperOffline

Installation

npm install @trinkui/react

Import

import { Table } from "@trinkui/react";

Usage

NameRoleStatus
Alice JohnsonDeveloperActive
Bob SmithDesignerActive
Carol WilliamsManagerAway
Dave BrownDeveloperOffline
<Table
  columns={[
    { key: "name", label: "Name" },
    { key: "role", label: "Role" },
    { key: "status", label: "Status", render: (val) => <Badge>{val}</Badge> },
  ]}
  data={[
    { name: "Alice Johnson", role: "Developer", status: "Active" },
    { name: "Bob Smith", role: "Designer", status: "Active" },
    { name: "Carol Williams", role: "Manager", status: "Away" },
    { name: "Dave Brown", role: "Developer", status: "Offline" },
  ]}
/>

Striped

NameRoleEmail
AliceDeveloperalice@example.com
BobDesignerbob@example.com
CarolManagercarol@example.com
DaveDeveloperdave@example.com
<Table striped columns={columns} data={data} />

Compact & Bordered

IDNameValue
001Alpha$1,200
002Beta$3,450
003Gamma$780
<Table compact bordered columns={columns} data={data} />

Table Props

PropTypeDefaultDescription
columnsTableColumn[]--Column definitions array
dataRecord<string, unknown>[]--Row data array keyed by column key
stripedbooleanfalseApply alternating row background colors
hoverablebooleanfalseHighlight rows on hover
borderedbooleanfalseShow borders between columns
compactbooleanfalseReduce cell padding for denser layouts

TableColumn Props

PropTypeDefaultDescription
keystring--Key that maps to the data field
labelstring--Column header text
render(value, row) => ReactNode--Custom cell renderer function
sortablebooleanfalseEnable sorting for this column
widthstring | number--Fixed column width (e.g. "120px" or "20%")

Accessibility

  • Uses semantic <table>, <thead>, <tbody>, <th>, and <td> elements.
  • Sortable column headers include aria-sort to indicate current sort direction.
  • Column headers use scope="col" for proper cell-to-header association.
  • Tables include a caption element when a title is provided.