Documentation
API Reference
Complete reference for all SimpleTable component props and HeaderObject configuration options.
SimpleTable Props
These are all the props available for the main SimpleTable component.
SimpleTable Component Props
| Property | Required | Description | Example |
|---|---|---|---|
defaultHeaders | Required | Array of column definitions that specify the structure of your table. | |
rows | Required | Array of data objects to display in the table. Each object represents a row. | |
rowIdAccessor | Required | Property name to use as row ID. This is crucial for proper row tracking, selection, and updates. | |
heightstring | Optional | Height of the table container. | |
rowHeightnumber | Optional | Height of each individual row in pixels. | |
allowAnimationsboolean | Optional | Beta feature! This feature is not yet fully tested and may not work as expected. Use at your own risk. Flag for allowing animations throughout the table. | |
cellUpdateFlashboolean | Optional | Flag for flash animation after cell update. | |
columnReorderingboolean | Optional | Enable column reordering by drag and drop. | |
columnResizingboolean | Optional | Enable column resizing functionality. | |
editColumnsboolean | Optional | Flag for column editing via column editor panel. | |
editColumnsInitOpenboolean | Optional | Flag for opening the column editor when the table is loaded. | |
expandAllboolean | Optional | Flag for expanding all rows by default (for grouped rows). | |
expandIconReactNode | Optional | Icon for expandable rows (will rotate on expand/collapse). | |
externalFilterHandlingboolean | Optional | Flag to let consumer handle filter logic completely. | |
externalSortHandlingboolean | Optional | When true, completely disables internal sorting logic. The table will not sort data internally - you must provide pre-sorted data via the rows prop. | |
hideFooterboolean | Optional | Flag for hiding the table footer. | |
onFilterChange(filters: TableFilterState) => void | Optional | Callback function triggered when filter configuration changes. Receives the current filter state with all active filters. | |
onLoadMore() => void | Optional | Callback function triggered when user scrolls near the bottom of the table to load more data. Useful for implementing infinite scrolling or paginated data loading. | |
onSortChange(sort: SortConfig | null) => void | Optional | Callback function triggered when sort configuration changes. Receives the current sort configuration or null if no sorting is applied. | |
rowGroupingstring[] | Optional | Array of property names that define row grouping hierarchy. | |
rowsPerPagenumber | Optional | Number of rows per page for pagination. | |
selectableCellsboolean | Optional | Enable cell selection functionality. | |
selectableColumnsboolean | Optional | Flag for selectable column headers. | |
shouldPaginateboolean | Optional | Flag for enabling pagination. | |
theme | Optional | Theme configuration for the table styling. | |
useOddColumnBackgroundboolean | Optional | Flag for using alternating column background colors. | |
useHoverRowBackgroundboolean | Optional | Flag for using hover row background highlighting. | |
useOddEvenRowBackgroundboolean | Optional | Flag for using odd/even row background colors. | |
enableRowSelectionboolean | Optional | Enable row selection functionality with checkboxes. | |
onRowSelectionChange | Optional | Callback function triggered when row selection changes. | |
onCellClick | Optional | Callback function triggered when a cell is clicked. Provides detailed information about the clicked cell including its position, value, and containing row. | |
onCellEdit | Optional | Callback function triggered when a cell is edited. Provides the edited cell information including the new value, row, and column accessor. | |
onColumnSelect | Optional | Callback when a column is selected/clicked. Provides the complete HeaderObject of the selected column. | |
enableHeaderEditingboolean | Optional | Flag for enabling header label editing when clicking already active headers. | |
onHeaderEdit | Optional | Callback when a header is edited. Receives the HeaderObject and the new label value. | |
onColumnOrderChange | Optional | Callback when column order changes (through drag and drop reordering). Receives the new headers array in the updated order. | |
columnBordersboolean | Optional | Flag for showing column borders. | |
headerDropdownHeaderDropdown | Optional | Custom dropdown component for headers. | |
rowButtonsRowButton[] | Optional | Array of buttons to show in each row. | |
selectionColumnWidthnumber | Optional | Width of the selection column (defaults to 42). | |
headerExpandIconReactNode | Optional | Custom icon component for the expand state of collapsible column headers. Shows when a column group can be expanded to reveal child columns. | |
headerCollapseIconReactNode | Optional | Custom icon component for the collapse state of collapsible column headers. Shows when a column group can be collapsed to hide child columns. | |
classNamestring | Optional | CSS class name to apply to the table container element. | |
columnEditorPosition | Optional | Position of the column editor panel when editColumns is enabled. | |
columnEditorTextstring | Optional | Custom text label for the column editor panel. | |
onGridReady() => void | Optional | Callback function triggered when the table grid is fully initialized and ready. | |
onNextPageOnNextPage | Optional | Custom handler for pagination next page action. | |
| Optional | React ref object to access table methods and state programmatically. Provides access to methods like exportToCSV and updateData. |
HeaderObject Configuration
These are all the properties available when defining column headers in the defaultHeaders array.
Header Object Properties
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The key to access data in your row objects. Must match a property in your data. | |
labelstring | Required | The display name shown in the column header. | |
widthnumber | string | Required | Column width. Can be pixels, string with units, or flexible units like '1fr'. | |
aggregation | Optional | Configuration for data aggregation when rows are grouped. | |
alignstring | Optional | Text alignment for the column content. Options: left center right | |
type | Optional | Data type for proper formatting and sorting behavior. Options: string number boolean date enum other | |
minWidthnumber | string | Optional | Minimum width constraint for the column. | |
isSortableboolean | Optional | Enable sorting for this column. | |
filterableboolean | Optional | Enable filtering for this column. | |
isEditableboolean | Optional | Enable inline editing for this column. | |
hideboolean | Optional | Hide this column from display. | |
disableReorderboolean | Optional | Prevent this column from being reordered. | |
expandableboolean | Optional | Make this column expandable for row grouping. | |
pinned | Optional | Pin this column to left or right side. Options: left right | |
children | Optional | Child columns for nested header structure. | |
enumOptions | Optional | Options for enum type columns (dropdown values). | |
cellRenderer({ accessor, colIndex, row, theme }: { accessor: Accessor; colIndex: number; row: Row; theme: Theme; }) => ReactNode | string | Optional | Custom render function for cell content. | |
headerRenderer({ accessor, colIndex, header }: { accessor: Accessor; colIndex: number; header: HeaderObject; }) => ReactNode | string | Optional | Custom render function for header content. | |
collapsibleboolean | Optional | Makes this column group collapsible. When true, users can click an arrow icon to collapse/expand the column group. Must have children columns. | |
showWhenShowWhen ("parentCollapsed" | "parentExpanded" | "always") | Optional | Controls when a child column is visible in collapsible groups. Can be "parentCollapsed" (only visible when collapsed), "parentExpanded" (only visible when expanded), or "always" (visible in both states). Default is "parentExpanded". | |
tooltipstring | Optional | Tooltip text that appears when hovering over the column header. Provides helpful context about the column's purpose or data. |
Type Definitions
All union type values and object type properties used in SimpleTable.
EnumOption
| Property | Required | Description | Example |
|---|---|---|---|
labelstring | Required | Display text shown in the dropdown | |
valuestring | Required | Actual value stored in the data |
AggregationConfig
| Property | Required | Description | Example |
|---|---|---|---|
type | Required | The aggregation function to use | |
parseValue(value: any) => number | Optional | Function to parse string values to numbers (e.g., '$15.0M' to 15000000) | |
formatResult(value: number) => string | Optional | Function to format the aggregated result back to string | |
customFn(values: any[]) => any | Optional | Custom aggregation function (only when type is 'custom') |
RowSelectionChangeProps
| Property | Required | Description | Example |
|---|---|---|---|
row | Required | The complete row object that was selected or deselected | |
isSelectedboolean | Required | Boolean indicating whether the row was selected (true) or deselected (false) | |
selectedRowsSet<string> | Required | Set containing the IDs of all currently selected rows |
CellClickProps
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key of the clicked cell | |
colIndexnumber | Required | The column index of the clicked cell (0-based) | |
row | Required | The complete row object containing the clicked cell | |
rowIdRowId | Required | The unique identifier of the row containing the clicked cell | |
rowIndexnumber | Required | The row index of the clicked cell (0-based) | |
value | Required | The value of the clicked cell |
FilterCondition
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key being filtered | |
operatorFilterOperator | Required | The filter operation to perform | |
value | Optional | Single value for most filter operations | |
values | Optional | Array of values for 'between', 'in', etc. operations |
Union Type Definitions
| Property | Required | Description | Example |
|---|---|---|---|
Accessorkeyof Row | Optional | Valid property key that exists in the Row type. Used to safely access row data. | |
CellValuestring | number | boolean | undefined | null | string[] | number[] | Record<string, any>[] | Optional | Valid data types that can be stored in a table cell. | |
Theme"light" | "dark" | "sky" | "violet" | "neutral" | "frost" | "custom" | Optional | Built-in theme options for styling the table. | |
AggregationType"sum" | "average" | "count" | "min" | "max" | "custom" | Optional | Available aggregation functions for grouped data. | |
Pinned"left" | "right" | Optional | Column pinning position options. | |
ColumnEditorPosition"left" | "right" | Optional | Position options for the column editor panel. | |
RowRecord<string, CellValue | Row[]> | Optional | Data object representing a single table row. Can contain cell values or nested row arrays for hierarchical data. | |
HeaderObject.typestring | number | boolean | date | enum | other | Optional | Data type for proper formatting and sorting behavior. |
SortConfig
| Property | Required | Description | Example |
|---|---|---|---|
key | Required | The HeaderObject representing the column being sorted. | |
direction"ascending" | "descending" | Required | The sort direction for the column. |
TableFilterState
| Property | Required | Description | Example |
|---|---|---|---|
filterCondition | Required | The FilterCondition object containing the filter logic. |
TableRefType Methods
| Property | Required | Description | Example |
|---|---|---|---|
exportToCSV | Optional | Exports the current table data to a CSV file. Respects active filters and sorting. Optionally accepts a props object to customize the filename. | |
updateData(params: { accessor: Accessor; rowIndex: number; newValue: CellValue }) => void | Optional | Programmatically update a specific cell value in the table. Useful for live updates and real-time data changes. Triggers cellUpdateFlash animation if enabled. |
ExportToCSVProps
| Property | Required | Description | Example |
|---|---|---|---|
filenamestring | Optional | Custom filename for the exported CSV file. Defaults to 'table-export.csv' if not provided. |