Table Widget
The table widget displays structured data in rows and columns with built-in support for sorting, selection, and virtualization for large datasets.Basic Usage
Column Definitions
Fixed Width Columns
Columns with explicitwidth maintain a fixed size:
Flex Columns
Columns withflex distribute remaining space proportionally:
Column Constraints
UseminWidth and maxWidth to constrain flex column sizing:
Custom Cell Rendering
Use therender function to customize cell content:
Text Alignment
Control cell content alignment:Sorting
Controlled Sorting
Row Selection
Single Selection
Multi-Selection
Supports Ctrl+Click and Shift+Click for range selection:Row Actions
Single Click
Double Click
Virtualization
Virtualization is enabled by default for performance with large datasets. Only visible rows (plus overscan buffer) are rendered.Large Dataset Example
Disable Virtualization
For small tables where full rendering is preferred:Visual Styling
Striped Rows
Border Style
Selection Style
Header Configuration
Hide Header
Header Height
Row Height
Performance Characteristics
- Initial render: O(viewport) - only visible rows are rendered
- Scroll update: ~2ms per frame - efficient viewport windowing
- Memory: O(viewport + overscan) - scales with visible area, not dataset size
- Column width calculation: O(columns) - one-time flex distribution
- Selection: O(1) lookup with internal Set-based tracking
Data Binding Patterns
Local State
Global State
Props Reference
TableProps
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | Required | Widget identifier |
columns | readonly TableColumn<T>[] | Required | Column definitions |
data | readonly T[] | Required | Row data array |
getRowKey | (row: T, index: number) => string | Required | Row key extractor |
rowHeight | number | 1 | Row height in cells |
headerHeight | number | 1 | Header row height |
selection | readonly string[] | [] | Selected row keys |
selectionMode | "none" | "single" | "multi" | "none" | Selection mode |
onSelectionChange | (keys: readonly string[]) => void | — | Selection change callback |
sortColumn | string | — | Currently sorted column |
sortDirection | "asc" | "desc" | — | Sort direction |
onSort | (column: string, direction: "asc" | "desc") => void | — | Sort change callback |
onRowPress | (row: T, index: number) => void | — | Row click callback |
onRowDoublePress | (row: T, index: number) => void | — | Row double-click callback |
virtualized | boolean | true | Enable virtualization |
overscan | number | 3 | Rows outside viewport |
stripedRows | boolean | false | Alternate row colors |
stripeStyle | TableStripeStyle | — | Stripe color config |
selectionStyle | TextStyle | — | Selected row style |
showHeader | boolean | true | Show header row |
borderStyle | TableBorderStyle | — | Border styling |
focusable | boolean | true | Include in tab order |
accessibleLabel | string | — | Accessibility label |
focusConfig | FocusConfig | — | Focus appearance |
dsSize | WidgetSize | "md" | Design system size |
dsTone | WidgetTone | "default" | Design system tone |
TableColumn
| Prop | Type | Default | Description |
|---|---|---|---|
key | string | Required | Unique column ID |
header | string | Required | Column header text |
width | number | — | Fixed width in cells |
minWidth | number | — | Minimum width |
maxWidth | number | — | Maximum width |
flex | number | — | Flex factor (default: 1 if no width) |
render | (value: unknown, row: T, index: number) => VNode | — | Custom cell renderer |
align | "left" | "center" | "right" | "left" | Content alignment |
overflow | "clip" | "ellipsis" | "middle" | "ellipsis" | Overflow handling |
sortable | boolean | false | Enable sorting |
Related Widgets
- Virtual List - List virtualization without columns
- Tree - Hierarchical data display
Location in Source
- Implementation:
packages/core/src/widgets/table.ts - Types:
packages/core/src/widgets/types.ts:1259-1369 - Factory:
packages/core/src/widgets/ui.ts:table()