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. | |
height | Optional | Height of the table container. If both height and maxHeight are defined, height will be ignored. | |
maxHeight | Optional | Maximum height of the table container with adaptive behavior. Works the same as height except that it will shrink if there are fewer rows. Enables virtualization while allowing the table to be smaller when content doesn't fill the maximum height. If both height and maxHeight are defined, height will be ignored. | |
customTheme | Optional | Custom theme configuration for dimensions and spacing. Only specify the properties you want to customize - all properties are optional and will use default values if not provided. | |
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. | |
initialSortColumnstring | Optional | Sets the column to sort by on initial table load. Provide the accessor of the column you want to sort by default. Works with both internal and external sorting. | |
initialSortDirection"asc" | "desc" | Optional | Sets the sort direction for the initial sort. Defaults to 'asc' if not specified. Only applies when initialSortColumn is also set. | |
hideHeaderboolean | Optional | Flag for hiding the table header row. When true, the entire header row will be hidden while maintaining all table functionality including sorting, filtering, and column operations. | |
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. | |
onRowGroupExpand | Optional | Callback function triggered when a grouped row is expanded or collapsed. Provides detailed information about the row, depth level, and grouping context, plus helper functions for managing loading, error, and empty states. The rowIndexPath array provides a direct path to update nested data. Perfect for implementing lazy-loading of hierarchical data with built-in state management. | |
loadingStateRendererstring | ReactNode | Optional | Custom content to display when a row is in loading state (set via setLoading in onRowGroupExpand). Can be a simple string or React component. Shown in place of row children while data is being fetched. If not provided, a default skeleton loading animation will be displayed automatically. | |
errorStateRendererstring | ReactNode | Optional | Custom content to display when a row has an error state (set via setError in onRowGroupExpand). Can be a simple string or React component. Shown in place of row children when data fetching fails. | |
emptyStateRendererstring | ReactNode | Optional | Custom content to display when a row has no children data (set via setEmpty in onRowGroupExpand). Can be a simple string or React component. Shown when data fetch succeeds but returns zero results. | |
canExpandRowGroup | Optional | Callback function to conditionally control whether a specific row group can be expanded. Return true to allow expansion, false to disable it. Useful for implementing permission-based access, hiding empty groups, or preventing expansion based on business logic. | |
rowsPerPagenumber | Optional | Number of rows per page for pagination. | |
onPageChange(page: number) => void | Promise<void> | Optional | Callback function triggered when page changes. Useful for server-side pagination to fetch data for the new page. | |
serverSidePaginationboolean | Optional | Flag to disable internal pagination slicing. When true, the table expects you to provide pre-paginated data via the rows prop and handle pagination externally. | |
totalRowCountnumber | Optional | Total number of rows available on the server (for server-side pagination). Used to calculate total pages and display correct pagination information. | |
selectableCellsboolean | Optional | Enable cell selection functionality. | |
copyHeadersToClipboardboolean | Optional | When true, includes column headers as the first row when copying selected cells to clipboard. Defaults to false. | |
selectableColumnsboolean | Optional | Flag for selectable column headers. | |
shouldPaginateboolean | Optional | Flag for enabling pagination. | |
isLoadingboolean | Optional | When set to true, all table cells will render skeleton loaders instead of actual data. Provides visual feedback while data is being fetched from the server. | |
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. | |
onColumnVisibilityChange | Optional | Callback triggered when column visibility changes (when users show/hide columns through the column editor). Receives a ColumnVisibilityState object mapping each column accessor to its visibility state (true = visible, false = hidden). Perfect for persisting user preferences or syncing visibility state with external storage. | |
autoExpandColumns | Optional | When true, automatically scales all column widths proportionally to fill the entire table container width. The width property of each column is used as the base for proportional scaling. Note: minWidth is NOT enforced during scaling (columns can shrink below minWidth), and maxWidth is NOT checked at all. Recommended: Set to false on mobile devices (< 768px) as horizontal scrolling provides better UX than cramped columns on small screens. | |
columnBordersboolean | Optional | Flag for showing column borders. | |
headerDropdownHeaderDropdown | Optional | Custom dropdown component for headers. | |
footerRenderer | Optional | Custom function to render the table footer. Receives pagination state and navigation handlers, allowing complete customization of footer appearance and behavior. | |
rowButtonsRowButton[] | Optional | Array of buttons to show in each row. | |
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. | ||
includeHeadersInCSVExportboolean | Optional | When true, includes column headers as the first row in CSV exports. Defaults to true. | |
tableEmptyStateRendererReactNode | Optional | Custom content to display in the table body when there are no rows to display. This can occur when filters return no results or when no data is provided. |
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. Supports nested properties using dot notation (e.g., 'user.profile.name' or 'latest.rank'). | |
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. Chart types render array data as inline visualizations. Options: string number boolean date enum lineAreaChart barChart other | |
chartOptions | Optional | Customization options for chart columns (lineAreaChart and barChart). Configure dimensions, colors, scaling, stroke width, and other visual properties. See the ChartOptions section for all available properties. | |
minWidthnumber | string | Optional | Minimum width constraint for the column. Note: When autoExpandColumns is enabled, minWidth is NOT enforced during initial scaling - columns can be scaled below their minWidth. | |
maxWidthnumber | string | Optional | Maximum width constraint for the column. Note: When autoExpandColumns is enabled, maxWidth is NOT enforced at all - the property is ignored during proportional scaling. | |
isSortableboolean | Optional | Enable sorting for this column. | |
sortingOrderArray<'asc' | 'desc' | null> | Optional | Custom sort order cycle for this column. Defines the sequence of sort states when clicking the column header. Default is ['asc', 'desc', null] which cycles through ascending → descending → no sort. Customize per column based on data type - use ['desc', 'asc', null] for numbers/dates where descending is more common, or ['asc', 'desc'] to prevent removing sort. | |
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. | |
nestedTable | Optional | Configuration for nested tables that allows each level of row grouping to have its own independent grid structure with different columns and settings. When a row is expanded, its child data is displayed in a completely separate table with its own headers, column configuration, and features. This is different from standard row grouping where all levels share the same columns. | |
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, rowIndex, rowPath, theme, value, formattedValue }: CellRendererProps) => ReactNode | string | Optional | Custom render function for cell content. Receives both raw and formatted values, row path for nested data access, and other cell context for flexible rendering. Use this for React components, custom styling, or interactive elements. For simple text formatting (currency, dates), use valueFormatter instead for better performance. | |
| Optional | Function to format the cell value for display without affecting the underlying data. Returns a string, number, or arrays of strings/numbers (v1.9.4+). Use this for currency, dates, percentages, and other simple text formatting. For React components or custom styling, use cellRenderer instead. | ||
valueGetter | Optional | Function to extract or compute values dynamically for sorting operations. Useful when the displayed value differs from the sorting value, or when sorting by nested properties. The extracted value is used for sorting while the display value (from valueFormatter or cellRenderer) remains unchanged. | |
comparator | Optional | Custom sorting function with full control over the sorting logic. Receives both row objects and sort direction, allowing complex multi-field sorting, metadata access, or domain-specific rules. Takes precedence over valueGetter and default sorting. | |
useFormattedValueForClipboardboolean | Optional | When true, cells copy the formatted value (from valueFormatter) when users press Ctrl+C/Cmd+C. When false (default), cells copy the raw underlying data. Useful for copying currency with $ symbols, percentages with %, or formatted dates. | |
useFormattedValueForCSVboolean | Optional | When true, CSV exports use the formatted value from valueFormatter instead of raw data. Perfect for human-readable reports. Note: exportValueGetter takes precedence if provided. | |
exportValueGetter | Optional | Custom function to provide completely different values specifically for CSV export. Takes highest priority over useFormattedValueForCSV. Ideal for adding codes, identifiers, or transforming data for spreadsheet compatibility. | |
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. | |
singleRowChildrenboolean | Optional | When true, displays the parent header and child headers horizontally in the same row (side-by-side) instead of the default nested structure where parent appears above children. This makes the parent header appear as a regular column that can collapse its sibling columns, rather than looking like a group header. Only applies to collapsible columns. | |
collapseDefaultboolean | Optional | When true, this column starts collapsed on initial render. Only applies to columns with collapsible set to true. Useful for showing a compact view by default. | |
excludeFromRenderboolean | Optional | When true, excludes this column from the rendered table and from the column visibility drawer/popout menu. The column data is still available for CSV export. Useful for ID columns or metadata that should be exported but not displayed or toggled by users. | |
excludeFromCsvboolean | Optional | When true, excludes this column from CSV exports. The column is still displayed in the table. Useful for sensitive data or UI-only columns that shouldn't be exported. |
CustomTheme Configuration
Custom theme configuration for dimensions and spacing that affect virtualization calculations. All properties are optional and will use default values if not specified. For a comprehensive guide with examples and use cases, see the Custom Theme documentation.
CustomTheme Properties
| Property | Required | Description | Example |
|---|---|---|---|
rowHeightnumber | Optional | Height of table rows in pixels. This value is used for virtualization calculations and cannot be styled through CSS. If not specified, uses the default value of 40px. | |
headerHeightnumber | Optional | Height of the table header in pixels. This value is used for virtualization calculations and cannot be styled through CSS. If not specified, uses the default value of 40px. | |
footerHeightnumber | Optional | Height of the table footer in pixels. This value is used for virtualization calculations and cannot be styled through CSS. If not specified, uses the default value of 50px. | |
rowSeparatorWidthnumber | Optional | Width of separators between rows in pixels. This value affects virtualization calculations and cannot be styled through CSS. If not specified, uses the default value of 1px. | |
borderWidthnumber | Optional | General border width in pixels (e.g., table borders, header borders). This value affects layout calculations and cannot be styled through CSS. If not specified, uses the default value of 1px. | |
pinnedBorderWidthnumber | Optional | Width of borders for pinned columns in pixels. This value affects layout calculations for pinned columns and cannot be styled through CSS. If not specified, uses the default value of 2px. | |
nestedGridBorderWidthnumber | Optional | Border width for nested grid tables (top + bottom) in pixels. This value affects nested table layout calculations and cannot be styled through CSS. If not specified, uses the default value of 2px. | |
nestedGridPaddingTopnumber | Optional | Top padding for nested grids in pixels. This value affects nested table layout calculations and cannot be styled through CSS. If not specified, uses the default value of 8px. | |
nestedGridPaddingBottomnumber | Optional | Bottom padding for nested grids in pixels. This value affects nested table layout calculations and cannot be styled through CSS. If not specified, uses the default value of 8px. | |
nestedGridPaddingLeftnumber | Optional | Left padding for nested grids in pixels. This value affects nested table layout calculations and cannot be styled through CSS. If not specified, uses the default value of 16px. | |
nestedGridPaddingRightnumber | Optional | Right padding for nested grids in pixels. This value affects nested table layout calculations and cannot be styled through CSS. If not specified, uses the default value of 16px. | |
nestedGridMaxHeightnumber | Optional | Maximum height for nested grids in pixels. This value controls how tall nested tables can grow before scrolling. If not specified, nested grids will grow to fit their content. | |
selectionColumnWidthnumber | Optional | Width of the row selection checkbox column in pixels. This value affects layout calculations and cannot be styled through CSS. If not specified, uses the default value of 40px. |
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') |
ChartOptions
| Property | Required | Description | Example |
|---|---|---|---|
minnumber | Optional | Custom minimum value for chart scaling. If not provided, the minimum data value is used. | |
maxnumber | Optional | Custom maximum value for chart scaling. If not provided, the maximum data value is used. | |
widthnumber | Optional | Custom chart width in pixels. Default is 100. | |
heightnumber | Optional | Custom chart height in pixels. Default is 30. | |
colorstring | Optional | Custom chart color (CSS color value). Overrides the theme color. | |
fillColorstring | Optional | Custom fill color for area charts (CSS color value). Only applies to lineAreaChart type. Overrides the theme fill color. | |
fillOpacitynumber | Optional | Fill opacity for area charts. Value between 0 and 1. Default is 0.2. Only applies to lineAreaChart type. | |
strokeWidthnumber | Optional | Line stroke width in pixels. Default is 2. Only applies to lineAreaChart type. | |
gapnumber | Optional | Gap between bars in pixels. Default is 2. Only applies to barChart type. |
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 |
ValueFormatterProps
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key for the cell being formatted | |
colIndexnumber | Required | The column index (0-based) | |
row | Required | The complete row object containing all data for this row | |
rowIndexnumber | Required | The row index (0-based) | |
value | Required | The raw cell value to be formatted |
ComparatorProps
| Property | Required | Description | Example |
|---|---|---|---|
rowA | Required | The first row object to compare | |
rowB | Required | The second row object to compare | |
valueA | Required | The raw cell value from rowA for the current column being sorted | |
valueB | Required | The raw cell value from rowB for the current column being sorted | |
direction"asc" | "desc" | Required | The sort direction | |
formattedValuestring | number | string[] | number[] | undefined | Optional | The formatted cell value (output from valueFormatter if defined). Available for both rowA and rowB. Useful when you need to compare formatted values or access both raw and formatted data in your comparison logic. |
CellRendererProps
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key for the cell being rendered | |
colIndexnumber | Required | The column index (0-based) | |
row | Required | The complete row object containing all data for this row | |
rowIndexnumber | Required | The row index (0-based) | |
rowPath(string | number)[] | Optional | Array path through the nested data structure to reach this row. Each element is either a number (array index) or string (property name). Useful for accessing nested/hierarchical data. | |
theme | Required | Current theme of the table | |
value | Required | The raw cell value | |
formattedValuestring | number | string[] | number[] | boolean | null | undefined | Optional | The formatted cell value (output from valueFormatter if defined). Use this for display purposes when you need both raw and formatted values. |
ExportValueProps
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key for the cell being exported | |
colIndexnumber | Required | The column index (0-based) | |
row | Required | The complete row object containing all data for this row | |
rowIndexnumber | Required | The row index (0-based) | |
value | Required | The raw cell value | |
formattedValuestring | number | undefined | Optional | The formatted cell value (if valueFormatter is defined) |
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 | |
rowIndexnumber | Required | The row index of the clicked cell (0-based) | |
value | Required | The value of the clicked cell |
OnRowGroupExpandProps
| Property | Required | Description | Example |
|---|---|---|---|
row | Required | The complete row object that is being expanded or collapsed | |
depthnumber | Required | The depth level of the row in the hierarchy (0 = top level, 1 = first nested level, etc.) | |
eventMouseEvent | Required | The original mouse click event that triggered the expand/collapse action | |
groupingKeystring | Optional | The property name that contains the children rows for this grouping level. Corresponds to the current level in the rowGrouping array. | |
isExpandedboolean | Required | Boolean indicating whether the row is being expanded (true) or collapsed (false). Use this to determine whether to fetch data. | |
rowIndexPath(string | number)[] | Required | Array path through the nested data structure to reach this row. Each element is either a number (array index) or string (property name). Use this to directly navigate and update nested data without complex traversal logic. | |
groupingKeysstring[] | Required | Array of all grouping keys from the hierarchy (from the rowGrouping prop). Provides context about the complete hierarchy structure. | |
setLoading(loading: boolean) => void | Required | Helper function to set the loading state for this specific row. When true, displays the loadingStateRenderer component. Call with false to clear the loading state. | |
setError(error: string | null) => void | Required | Helper function to set an error state for this specific row. Pass an error message string to display the errorStateRenderer component, or null to clear the error state. | |
setEmpty(isEmpty: boolean, message?: string) => void | Required | Helper function to set an empty state for this specific row. When true, displays the emptyStateRenderer component. Optionally provide a custom message as the second parameter. |
HeaderRendererProps
| Property | Required | Description | Example |
|---|---|---|---|
accessor | Required | The column accessor/key identifying which column this header belongs to | |
colIndexnumber | Required | The zero-based index of the column within the table | |
header | Required | The complete HeaderObject containing all configuration for this column including label, width, and other properties | |
componentsHeaderRendererComponents | Optional | Object containing pre-rendered header components (sortIcon, filterIcon, collapseIcon, labelContent) that can be positioned anywhere in your custom header renderer. This gives you complete control over the layout and order of header elements. |
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 | string | Optional | Valid property key that exists in the Row type. Used to safely access row data. Supports nested properties using dot notation (v1.7.6+) and array indices (v1.9.4+). | |
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" | "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[] | Record<string, any>> | Optional | Data object representing a single table row. Can contain cell values, nested row arrays for hierarchical data, or any additional properties. | |
HeaderObject.typestring | number | boolean | date | enum | lineAreaChart | barChart | other | Optional | Data type for proper formatting and sorting behavior. Includes chart types for visualizing array data inline. | |
SortDirection"asc" | "desc" | Optional | The sort direction for table columns. Used with applySortState() method for programmatic sort control. If direction is omitted from applySortState(), the sort cycles through: asc → desc → removed. | |
| Optional | Object representing the current sort state of the table. Contains the column being sorted (as a HeaderObject) and the sort direction. Returned by getSortState() method. |
SortConfig
| Property | Required | Description | Example |
|---|---|---|---|
key | Required | The HeaderObject representing the column being sorted. | |
direction"asc" | "desc" | Required | The sort direction for the column. |
TableFilterState
| Property | Required | Description | Example |
|---|---|---|---|
filterCondition | Required | The FilterCondition object containing the filter logic. |
ColumnVisibilityState
| Property | Required | Description | Example |
|---|---|---|---|
[accessor: string]boolean | Required | Maps column accessor to visibility state. Each key is a column accessor, and the value is a boolean indicating whether the column is visible (true) or hidden (false). |
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. | |
setHeaderRename(params: { accessor: Accessor }) => void | Optional | Programmatically triggers the header rename mode for a specific column. Sets the header cell to editing mode, allowing the user to rename it. The header must have enableHeaderRename enabled. | |
getVisibleRows() => TableRow[] | Optional | Returns the currently visible rows in the table. When pagination is enabled, this returns only the rows on the current page. When filters are applied, returns only filtered rows. This is useful for getting a snapshot of what the user is currently viewing. | |
getAllRows() => TableRow[] | Optional | Returns all rows in the table as TableRow objects, flattened and including nested/grouped rows. Each TableRow contains the raw row data plus metadata like depth, position, and rowPath. Unlike getVisibleRows, this returns the complete dataset regardless of pagination, filters, or grouping state. Perfect for exporting complete data, analytics, or batch operations. | |
getHeaders() => HeaderObject[] | Optional | Returns the table's current header/column definitions. Includes all column configuration such as accessors, labels, types, and formatting options. Useful for dynamic table manipulation, export configurations, or building custom UI controls. | |
getSortState | Optional | Returns the current sort state of the table. Returns null if no sorting is applied, or a SortColumn object containing the sorted column and direction. Useful for persisting table state, synchronizing with external state management, or implementing custom sort UI. | |
| Optional | Programmatically applies a sort state to the table. Pass a column accessor and optional direction to sort, or undefined to clear sorting. If direction is omitted, the sort cycles through: asc → desc → removed. This method is async and returns a Promise. Perfect for implementing custom sort controls or coordinating sorting with external data sources. | ||
getFilterState | Optional | Returns the current filter state of the table as a TableFilterState object. The object contains all active filters keyed by unique filter IDs. Each filter includes the column accessor, operator, and values. Useful for debugging, persisting filter state, or building custom filter UI. | |
applyFilter | Optional | Programmatically applies a filter to a specific column. Accepts a FilterCondition object specifying the column accessor, filter operator, and value(s). This method is async and returns a Promise. Supports all filter operators including equals, contains, greaterThan, between, and more. Perfect for implementing custom filter UI, applying saved filters, or creating filter presets. | |
clearFilter | Optional | Clears the filter for a specific column identified by its accessor. This method is async and returns a Promise. Only removes filters applied to the specified column, leaving other column filters intact. Useful for implementing 'clear filter' buttons on individual columns or resetting specific filters programmatically. | |
clearAllFilters() => Promise<void> | Optional | Clears all active filters from the table at once. This method is async and returns a Promise. Resets the table to show all data without any filtering applied. Perfect for 'reset all filters' buttons or starting fresh with filter state. | |
getCurrentPage() => number | Optional | Returns the current page number when pagination is enabled. Page numbers are 1-indexed (first page is 1, not 0). Returns the current page regardless of whether pagination is client-side or server-side. Useful for tracking user navigation, syncing with URL parameters, or building custom pagination UI. | |
setPage(page: number) => Promise<void> | Optional | Programmatically navigates to a specific page when pagination is enabled. Accepts a 1-indexed page number (first page is 1). This method is async and returns a Promise. Works with both client-side and server-side pagination. If the page number is out of range, it will be clamped to valid bounds. Triggers the onPageChange callback when the page changes. Perfect for implementing custom pagination controls, deep linking, or restoring saved pagination state. | |
expandAll() => void | Optional | Expands all rows at all depths in the table. When working with hierarchical/grouped data, this will expand every level of the hierarchy, revealing all nested rows. Useful for 'expand all' buttons or when you want to show the complete data structure to users. | |
collapseAll() => void | Optional | Collapses all rows at all depths in the table. When working with hierarchical/grouped data, this will collapse every level of the hierarchy, hiding all nested rows. Perfect for 'collapse all' buttons or resetting the table to a compact view. | |
expandDepth(depth: number) => void | Optional | Expands all rows at a specific depth level (0-indexed). Depth 0 represents the top-level rows, depth 1 is the first nested level, depth 2 is the second nested level, and so on. This allows granular control over which hierarchy levels are visible. Useful for showing specific levels of detail without expanding everything. | |
collapseDepth(depth: number) => void | Optional | Collapses all rows at a specific depth level (0-indexed). Depth 0 represents the top-level rows, depth 1 is the first nested level, and so on. This allows you to selectively hide specific hierarchy levels while keeping others visible. Useful for managing complex hierarchies and controlling information density. | |
toggleDepth(depth: number) => void | Optional | Toggles the expansion state for all rows at a specific depth level (0-indexed). If the depth is currently expanded, it will be collapsed, and vice versa. This provides a convenient way to toggle visibility of an entire hierarchy level without tracking state manually. | |
setExpandedDepths(depths: Set<number>) => void | Optional | Sets which depth levels should be expanded, replacing the current expansion state entirely. Accepts a Set of depth numbers (0-indexed). This is useful for restoring saved expansion state, implementing presets, or coordinating expansion across multiple tables. Any depth not in the Set will be collapsed. | |
getExpandedDepths() => Set<number> | Optional | Returns a Set containing all currently expanded depth levels (0-indexed). This allows you to inspect which hierarchy levels are currently visible. Useful for saving expansion state, building custom UI controls, or coordinating with other components. | |
getGroupingProperty(depth: number) => Accessor | undefined | Optional | Returns the grouping property name (accessor) for a specific depth index (0-indexed). This maps depth levels to their corresponding property names in your rowGrouping configuration. Returns undefined if the depth doesn't exist. Useful for understanding the hierarchy structure or building dynamic UI that adapts to the grouping configuration. | |
getGroupingDepth(property: Accessor) => number | Optional | Returns the depth index (0-indexed) for a specific grouping property name (accessor). This is the inverse of getGroupingProperty - it maps property names to their depth levels in the hierarchy. Returns -1 if the property is not part of the grouping configuration. Useful for programmatically determining which level a property belongs to. |
ExportToCSVProps
| Property | Required | Description | Example |
|---|---|---|---|
filenamestring | Optional | Custom filename for the exported CSV file. Defaults to 'table-export.csv' if not provided. |
FooterRendererProps
| Property | Required | Description | Example |
|---|---|---|---|
currentPagenumber | Required | The current page number (1-based index). | |
startRownumber | Required | The starting row number for the current page (1-based index). | |
endRownumber | Required | The ending row number for the current page (1-based index). | |
totalRowsnumber | Required | The total number of rows in the table. | |
totalPagesnumber | Required | The total number of pages based on rowsPerPage. | |
rowsPerPagenumber | Required | The number of rows displayed per page. | |
hasPrevPageboolean | Required | Boolean indicating if there is a previous page available. | |
hasNextPageboolean | Required | Boolean indicating if there is a next page available. | |
onPrevPage() => void | Required | Function to navigate to the previous page. | |
onNextPage() => Promise<void> | Required | Async function to navigate to the next page. | |
onPageChange(page: number) => void | Required | Function to navigate to a specific page number. | |
prevIconReactNode | Optional | Optional custom icon for the previous page button. | |
nextIconReactNode | Optional | Optional custom icon for the next page button. |