Skip to main content

Table

A data table with sorting, custom cell rendering, and multiple visual variants.

Basic Usage

NameRoleStatus
AliceEngineerActive
BobDesignerInactive
CharlieManagerActive

Sortable Columns

NameAgeCity
Alice30Seoul
Bob25Tokyo
Charlie35London

Variants

NameValue
Item A100
Item B200
Item C300
Item D400

Zebra & sticky header

zebra alternates row backgrounds (similar to variant="striped" but composable with other variants), and stickyHeader keeps the header row visible while scrolling long datasets.

NameValue
Item A100
Item B200
Item C300

Mobile layout

Tables don't fit small viewports gracefully. mobileVariant lets you pick the strategy:

ValueBehavior
scroll (default)Horizontal scroll inside a --tui-glass-shadowed container. Header stays aligned.
stackedEach row collapses into a vertical card with column.header as the label and the cell content as the value. Loses tabular comparison but reads naturally.
<Table mobileVariant="stacked" columns={cols} data={rows} />

Pick stacked when each row represents an independent entity (a user, an order). Stick with scroll when users need to compare values across rows.

Empty State

Name
No records found

Table Props

PropTypeDefaultDescription
columnsColumn<T>[]-Column definitions ({ key, header, render?, sortable?, width?, align? })
dataT[]-Data rows
variant'default' | 'striped' | 'bordered''default'Visual variant
size'sm' | 'md' | 'lg''md'Size preset
stickyHeaderbooleanfalseSticky header on scroll
zebrabooleanfalseAlternate row backgrounds with --tui-bg-muted
mobileVariant'scroll' | 'stacked''scroll'On narrow viewports: horizontal scroll or stacked-card per row
hoverablebooleantrueHighlight rows on hover
emptyTextstring'No data available'Text shown when data is empty
onRowClick(row: T, index: number) => void-Row click handler
rowKeystring | ((row: T) => string)-Key extractor for row identity
classNamestring-Additional CSS class name
styleCSSProperties-Additional inline styles