Skip to content

Adapter API (React / Vue / Vanilla)

Every prop and mount option of the framework adapters — the React <TensorGrid> / <TensorPivot> / <TensorVirtualGrid> components, their Vue equivalents, and the zero-dependency vanilla mountTensorGrid / mountTensorPivot / mountVirtualGrid functions (plus their returned control handles). The three adapters share the same option surface over @tensorgrid/core.

NameTypeDefaultDescription
TensorGrid.footerLabel
Aggregation
string'Total'Label for the footer row's group cell. Only used when showFooter.
TensorGrid.grandTotal
Aggregation
booleanfalsePrepend a grand-total row.
TensorGrid.measures
Aggregation
Record<string, string>{ measure: agg } (built-in string aggregations). Optional when autoGroup infers them.
TensorGrid.showFooter
Aggregation
booleanfalseRender a footer (grand-total) row: each base measure aggregated over the WHOLE frame via core gridGrandTotal (engine semantics — not a client-side sum of pre-aggregated leaves). A window/derived column shows the null text.
TensorGrid.topN
Aggregation
{ by: string; n: number; others?: boolean; othersLabel?: string }Keep only the top-n children (by measure by, descending) at EVERY level, via core topNChildren. With others, the rest roll into one 'Others' node that SUMS the measures (othersLabel default 'Others'). Runs after filtering, before sort. Avoid combining with grandTotal.
TensorPivot.measures *
Aggregation
Record<string, string>{ measure: agg } (built-in string aggregations).
TensorVirtualGrid.footerLabel
Aggregation
string'Total'Label for the footer row's label cell. Only used when showFooter.
TensorVirtualGrid.grandTotal
Aggregation
booleanfalsePrepend a grand-total row.
TensorVirtualGrid.measures *
Aggregation
Record<string, string>{ measure: agg } (built-in string aggregations).
TensorVirtualGrid.showFooter
Aggregation
booleanRender a PINNED grand-total footer row BELOW the scroller (always visible while the list scrolls) — each measure over the WHOLE frame via core gridGrandTotal.
GridMountOptions.cellRenderers
Cell-viz
Record<string, (value: unknown, node: TreeNode) => string | null>Custom cell renderer per measure column. The returned HTML is inserted VERBATIM (NOT escaped — an allow_html-style escape hatch). Return null to fall back to the formatted value. Highest cell-content precedence. Use the exported htmlEscape on interpolated data. (Vanilla returns an HTML string, unlike React/Vue nodes.)
TensorGrid.cellRenderers
Cell-viz
Record<string, (value: unknown, node: TreeNode) => ReactNode>Custom cell renderer per measure column (by accessorKey). Build any cell content (link, badge, button, chip) as React elements (XSS-safe; no innerHTML). Return null/undefined to fall back to the formatted value. Highest cell-content precedence.
TensorGrid.colorScales
Cell-viz
Record<string, ColorScaleSpec>Continuous color-scale (heatmap) per measure column (by accessorKey): { min, max, mid?, domainMin?, domainMax? }. Each cell's background is interpolated from its raw value's position in that column's range over the whole tree (grand-total row excluded). An explicit cellStyles background wins.
TensorGrid.dataBars
Cell-viz
Record<string, DataBarSpec>In-cell data bar per measure column (by accessorKey): { color, domainMin?, domainMax? }. Left-anchored gradient bar whose length is the value's fraction of [0, column max]. Background precedence: cellStyles background > dataBars > colorScales.
TensorGrid.iconSets
Cell-viz
Record<string, IconSetSpec>3-level icon set per measure column (by accessorKey): { set?, thresholds?, colors?, icons?, reverse? }. Colored traffic-light / trend-arrow icon for its level in the column domain (thirds by default). An explicit cellStyles icon wins.
TensorGrid.sparklines
Cell-viz
Record<string, SparklineOptions>Inline sparkline per measure column (by accessorKey). That column's cells render a dependency-free SVG line/bar chart from their ARRAY value (a per-node series) instead of a number.
TensorPivot.cellRenderers
Cell-viz
Record<string, (value: unknown, node: TreeNode) => ReactNode>Host cell renderer keyed by MEASURE NAME. Every pivoted column cell of that measure replaces its formatted value with the returned node (XSS-safe); null/undefined falls back. Highest cell-content precedence; a conditional icon still prepends.
TensorPivot.colorScales
Cell-viz
Record<string, ColorScaleSpec>Continuous color-scale keyed by MEASURE NAME: every pivoted column cell of that measure shares ONE domain across the cross-tab. The grand-total COLUMN cells are EXCLUDED from the domain but still coloured, clamped. A cellStyles background wins.
TensorPivot.dataBars
Cell-viz
Record<string, DataBarSpec>In-cell data bar keyed by MEASURE NAME (same per-measure domain + grand-total-column exclusion as colorScales). Background precedence: cellStyles background > dataBars > colorScales.
TensorPivot.iconSets
Cell-viz
Record<string, IconSetSpec>3-level icon set keyed by MEASURE name. Every column cell of that measure gets a colored icon for its level in the shared per-measure domain. A cellStyles icon wins.
TensorVirtualGrid.cellRenderers
Cell-viz
Record<string, (value: unknown, node: TreeNode) => ReactNode>Host cell renderer per measure column (by accessorKey). Returns a ReactNode that replaces the formatted value; XSS-safe. Highest cell-content precedence.
TensorVirtualGrid.colorScales
Cell-viz
Record<string, ColorScaleSpec>Continuous color-scale (heatmap) per measure column (by accessorKey), over the whole display tree (grand-total excluded). A cellStyles background wins.
TensorVirtualGrid.dataBars
Cell-viz
Record<string, DataBarSpec>In-cell data bar per measure column (by accessorKey). Length is the value's fraction of [0, column max]. Background precedence: cellStyles background > dataBars > colorScales.
TensorVirtualGrid.iconSets
Cell-viz
Record<string, IconSetSpec>3-level icon set per measure column (by accessorKey). A cellStyles icon wins.
TensorVirtualGrid.sparklines
Cell-viz
Record<string, SparklineOptions>Inline sparkline per measure column (by accessorKey). An array-valued cell renders a mini SVG line/bar chart instead of a number.
GridMountOptions
Chrome
interface { data; rows?; measures?; autoGroup?; formats?; headers?; grandTotal?; having?; showFooter?; footerLabel?; groupHeader?; locale?; masterDetail?; detailLimit?; editable?; onCellEdit?; validationRules?; onEditRejected?; cellStyles?; colorScales?; dataBars?; iconSets?; sparklines?; cellRenderers?; topN?; pinFirstColumn?; windowColumns?; enableClipboard?; onCopy?; showStatusBar?; enableKeyboardNav?; showSearch?; searchPlaceholder?; showExportButton?; onExport?; exportLabel?; exportMode?; exportFormatted?; showSelectionToolbar?; selectAllLabel?; clearSelectionLabel?; showDensityToggle?; density?; onDensityChange?; noRowsMessage?; showColumnToggle?; hiddenColumns?; onColumnVisibilityChange?; columnOrder?; enableColumnReorder?; onColumnReorder?; resizableColumns?; columnWidths?; onColumnResize? }Options object for mountTensorGrid. data required; rows/measures optional when autoGroup. Semantics of each option match the corresponding React TensorGrid prop; groupHeader (default first dim's header override or 'Group') and cellRenderers return an HTML string (verbatim, trusted — use htmlEscape) rather than a ReactNode. showStatusBar/showColumnToggle/columnOrder/enableColumnReorder/resizableColumns all supported.
mountTensorGrid *
Chrome
(el: HTMLElement, options: GridMountOptions) => MountHandle<GridMountOptions>Zero-dependency imperative mount of a roll-up tree table (core renderGridHtml) into el, with delegated click-to-expand. Returns the control handle. Every option mirrors the React TensorGrid props but as a plain options object (mount-time, not reactive props); selection is pull-model (read via handle.getSelected(), no onSelectionChange).
TensorGrid *
Chrome
(props: TensorGridProps) => ReactElementReact roll-up tree grid component over @tensorgrid/core. Props are raw data + a grouping/measure spec; it builds the tree (treePayload), column defs (makeColumnDefs) and formatted cells (formatValue) entirely client-side and renders a TanStack-free <table> with click-to-expand. createElement-based (no JSX); React 18 is a peer dependency.
TensorGrid.density
Chrome
'comfortable' | 'standard' | 'compact''standard'Initial (and, without the toggle, fixed) row density. Applies the tg-density-<level> class when set even if the toggle button is not shown.
TensorGrid.enableKeyboardNav
Chrome
booleanOpt-in keyboard row navigation: roving-tabindex arrow Up/Down move an active row (.tg-active, focused), Home/End jump to first/last, Space toggles selection, Shift+Arrow extends the selection range (core selectionRange), Enter / ArrowRight / ArrowLeft expand/collapse a group row.
TensorGrid.noRowsMessage
Chrome
stringWhen the grid has ZERO visible rows (every row filtered out), render this text in a single full-width .tg-no-rows placeholder row instead of an empty body. Omitted = empty body.
TensorGrid.onDensityChange
Chrome
(level: 'comfortable' | 'standard' | 'compact') => voidFired with the new level after each density change (toggle click).
TensorGrid.pinFirstColumn
Chrome
booleanFreeze the group (label) column via position: sticky so it stays visible on horizontal scroll. The adapter owns positioning + a tg-pinned class; the HOST must provide an overflow-x:auto wrapper and an opaque background for the pinned cells.
TensorGrid.searchPlaceholder
Chrome
string'Search'Placeholder text for the built-in search input.
TensorGrid.showDensityToggle
Chrome
booleanRender an opt-in .tg-density-toggle button that cycles the row density comfortable -> standard -> compact, applied as a tg-density-<level> class on the .tg-grid table.
TensorGrid.showExpandControls
Chrome
booleanfalseRender an opt-in toolbar above the grid with Expand all / Collapse all / Level N buttons that set the expanded-state via core expandToDepth. Host styles .tg-expand-controls (.tg-grid-wrap wraps the toolbar + table).
TensorGrid.showSearch
Chrome
booleanRender an opt-in built-in .tg-search input above the grid that filters rows via core quickFilterPredicate (case-insensitive substring over the row dimensions). ANDs with the quickFilter prop.
TensorGrid.showStatusBar
Chrome
booleanRender an opt-in .tg-status-bar footer with the selection size + per-measure count/sum/avg/min/max (core summarizeRows over selected SOURCE rows). Only appears when a selection exists.
TensorPivot.noRowsMessage
Chrome
stringWhen the cross-tab has ZERO body rows, render this text in a full-width .tg-no-rows placeholder row instead of an empty body.
TensorPivot.pinFirstColumn
Chrome
booleanfalseFreeze the group (row-hierarchy) column via position: sticky (.tg-pinned) so it stays visible while a wide cross-tab scrolls horizontally. Host wraps in overflow-x:auto + gives .tg-pinned an opaque background.
TensorPivot.searchPlaceholder
Chrome
string'Search'Placeholder text for the built-in search input.
TensorPivot.showSearch
Chrome
booleanRender an opt-in built-in .tg-search input above the cross-tab that filters the ROW hierarchy via the core quick-filter (over ALL row dims). ANDs with the root filter.
TensorVirtualGrid.noRowsMessage
Chrome
stringWhen the filtered view is EMPTY, render this text in a single full-width .tg-no-rows placeholder instead of a blank scroller.
TensorVirtualGrid.searchPlaceholder
Chrome
string'Search'Placeholder text for the built-in search input.
TensorVirtualGrid.showSearch
Chrome
booleanRender an opt-in built-in .tg-search input above the scroller (core quick-filter over the row dims). ANDs with the quickFilter prop.
Vue TensorGrid
Chrome
defineComponent; props: TensorGridPropsVue 3 render-function adapter (h, no SFC). Prop interface is IDENTICAL to React TensorGridProps (same names/types/defaults for data, apiRef, rows, measures, autoGroup, formats, headers, grandTotal, having, locale, quickFilter, enableColumnFilters, rootFilter, onSelectionChange, enableClipboard, onCopy, showExpandControls, showStatusBar, enableKeyboardNav, showSearch, searchPlaceholder, showExportButton, onExport, exportLabel, exportMode, exportFormatted, showSelectionToolbar, selectAllLabel, clearSelectionLabel, showDensityToggle, density, onDensityChange, noRowsMessage, showColumnToggle, hiddenColumns, onColumnVisibilityChange, columnOrder, enableColumnReorder, onColumnReorder, resizableColumns, columnWidths, onColumnResize, masterDetail, detailLimit, editable, onCellEdit, validationRules, onEditRejected, cellStyles, topN, pinFirstColumn, windowColumns, showFooter, footerLabel, colorScales, dataBars, iconSets, sparklines, cellRenderers). Vue delta: cellRenderers return VNodeChild (not ReactNode); apiRef is a Vue ref(null). Vue 3 is a peer dependency.
TensorGrid.enableClipboard
Clipboard
booleanWith a non-empty selection, Ctrl/Cmd-C copies the selected SOURCE rows to the system clipboard as CSV (best-effort navigator.clipboard.writeText). Composes core toCsv(rowsForSelection(...)).
TensorGrid.onCopy
Clipboard
(csv: string) => voidAlso (or instead) receive the CSV of the selected SOURCE rows on each Ctrl/Cmd-C copy. Providing this enables the copy gesture even when enableClipboard is unset.
MountHandle.setColumnOrder
Column
setColumnOrder?(order: string[] | null): voidSet the MEASURE-column display order (accessorKeys; unknown keys ignored, unlisted measures keep their relative order after). null/[] restores natural order. Reorders live + fires onColumnReorder. GRID only (no-op on the pivot).
TensorGrid.columnOrder
Column
string[]Initial MEASURE-column display order (accessorKeys). Keys listed render first in this order; measures not listed keep their original relative position after them (via core reorderMeasureCols).
TensorGrid.columnWidths
Column
Record<string, number>Initial per-column widths in px, keyed by measure accessorKey or '__group__' for the group column.
TensorGrid.enableColumnReorder
Column
booleanEnable drag-to-reorder of MEASURE column headers (HTML5 drag; drop swaps the order). Fires onColumnReorder. The group/dimension header is fixed.
TensorGrid.hiddenColumns
Column
string[]none (all shown)Measure accessorKeys hidden initially (checkbox unchecked).
TensorGrid.onColumnReorder
Column
(order: string[]) => voidFired with the new measure-column order after a drag-reorder (or apiRef.setColumnOrder).
TensorGrid.onColumnResize
Column
(widths: Record<string, number>) => voidFired after each resize drag with the current width map — keyed by measure accessorKey, plus '__group__' for the group column (e.g. { __group__: 150, revenue: 80 }).
TensorGrid.onColumnVisibilityChange
Column
(hidden: string[]) => voidFired with the accessorKeys currently hidden after each column-visibility toggle.
TensorGrid.resizableColumns
Column
booleanMake columns resizable: each measure header AND the group/dimension header gets a drag handle that sets its width. For strict widths incl. shrinking below content, give the table table-layout: fixed; otherwise a width acts as a minimum.
TensorGrid.showColumnToggle
Column
booleanRender an opt-in .tg-column-toggle control — one checkbox per MEASURE column that shows/hides that column client-side (the group/dimension column is always shown). No backend round-trip.
TensorGrid.cellStyles
Conditional-format
Record<string, CellStyleRule[]>Conditional formatting: per measure-column (by accessorKey) rules applied to each cell's RAW value via core evalCellStyle (first-match-wins; same operator vocabulary as filter conditions). The winning rule's style (camelCase CSS) is merged and its className appended. Example: { revenue: [{ op: '<', value: 0, style: { color: 'red' } }] }.
TensorPivot.cellStyles
Conditional-format
Record<string, CellStyleRule[]>Conditional formatting keyed by MEASURE NAME (not the raw <colPath>::<measure> accessorKey): rules apply to EVERY column cell of that measure (a heatmap across pivoted columns) via core evalCellStyle.
TensorVirtualGrid.cellStyles
Conditional-format
Record<string, CellStyleRule[]>Conditional formatting per measure-column (by accessorKey) via core evalCellStyle (first-match-wins).
MountHandle.collapseAll
Core-api-handle
collapseAll(): voidCollapse every node to the roots.
MountHandle.destroy
Core-api-handle
destroy(): voidRemove listeners and clear the container.
MountHandle.expandAll
Core-api-handle
expandAll(): voidExpand every expandable node.
MountHandle.expandToLevel
Core-api-handle
expandToLevel(depth: number): voidExpand every node down to `depth` levels via core expandToDepth (depth<=0 collapses to roots; a depth past the deepest fully expands). Backs 'expand to level N' controls.
MountHandle.getExpanded
Core-api-handle
getExpanded(): Record<string, boolean>Read the current expanded-state map.
MountHandle.setExpanded
Core-api-handle
setExpanded(expanded: Record<string, boolean>): voidReplace the expanded-state map.
MountHandle.update
Core-api-handle
update(options: Partial<O>): voidMerge new options and rebuild (expansion + sort state kept — node ids are stable).
TensorGrid.autoGroup
Data
booleanfalse'Just pass data': when set and rows is omitted/empty, infer the dimension hierarchy + numeric measures from the flat data via core inferSchema (non-numeric cols -> dims by ascending cardinality; numeric cols -> summed measures). Explicit rows / measures always win.
TensorGrid.data *
Data
Record<string, unknown>[]Raw source rows.
TensorGrid.rows
Data
string[]Row dimension columns (the roll-up hierarchy), root -> leaf. Optional when autoGroup infers them.
TensorPivot.data *
Data
Record<string, unknown>[]Raw source rows.
TensorPivot.rows *
Data
string[]Row dimension columns (the row hierarchy), root -> leaf.
TensorVirtualGrid.data *
Data
Record<string, unknown>[]Raw source rows.
TensorVirtualGrid.rows *
Data
string[]Row dimension columns (the roll-up hierarchy), root -> leaf.
TensorGrid.detailLimit
Editing
number20Max detail rows shown per leaf.
TensorGrid.editable
Editing
booleanWith masterDetail: detail SOURCE cells become click-to-edit (input swap; Enter/blur commits, Escape cancels). A commit runs core applyEdit over an internal data overlay and rebuilds the tree. The overlay resets when data changes identity.
TensorGrid.masterDetail
Editing
booleanMaster-detail: clicking a LEAF row toggles an inline table of its underlying SOURCE rows (core drillThrough over data).
TensorGrid.onCellEdit
Editing
(edit: CellEdit) => voidFired after a committed edit with the applied CellEdit.
TensorGrid.onEditRejected
Editing
(detail: EditRejectedDetail) => voidFired when an edit is REJECTED (a ValidationRule, the stale guard, or the dtype guard); the edit is dropped. EditRejectedDetail = { column, rowIndex, code, message }.
TensorGrid.validationRules
Editing
Record<string, ValidationRule[]>Per-column edit-validation rules passed to core applyEdit; a rejected edit is dropped (source value restored) and reported via onEditRejected.
MountHandle.aggregatedToCsv
Export
aggregatedToCsv(csvOpts?: CsvExportOptions): stringCSV of the AGGREGATED roll-up as shown — filter / sort / top-N / window columns applied — via core treeToCsv (one column per dimension level + one per measure). { format: true } emits the DISPLAYED (formatted) values. Tree-grid oriented (the pivot uses its own toCsv).
MountHandle.exportCsv
Export
exportCsv(): stringCSV of the selected SOURCE rows if a selection exists, else ALL source rows (core rowsForSelection / toCsv). Backs the opt-in Export button.
MountHandle.selectionToCsv
Export
selectionToCsv(csvOpts?: ToCsvOptions): stringCSV of the SOURCE rows under the selection (core rowsForSelection + toCsv: topmost paths deduped — an ancestor covers its descendants — order-preserving union).
PivotMountHandle.toCsv
Export
toCsv(csvOpts?: PivotCsvOptions): stringThe current cross-tab as CSV: one column per row dimension + one per pivoted measure leaf (named by its flattened group path). Raw numerics; all tree levels (subtotals included). PivotMountHandle extends MountHandle<PivotMountOptions>.
TensorGrid.exportFormatted
Export
booleanfalseWith exportMode='aggregated', emit the DISPLAYED (formatted) measure values (each column's formatStr) instead of raw numerics.
TensorGrid.exportLabel
Export
string'Export CSV'Label for the Export button.
TensorGrid.exportMode
Export
'source' | 'aggregated''source'What the Export button emits: 'source' = the raw underlying rows (selected, or all) via toCsv(rowsForSelection(...)); 'aggregated' = the roll-up AS SHOWN (dimension columns + measures, every level) via core treeToCsv over the current display tree.
TensorGrid.onExport
Export
(csv: string) => voidReceives the CSV when the Export button is clicked (selected source rows, or all rows if none selected).
TensorGrid.showExportButton
Export
booleanRender an opt-in Export button above the grid. Clicking fires onExport with the CSV of the SELECTED source rows (core rowsForSelection + toCsv) if a selection exists, else ALL source rows. Callback-only.
TensorPivot.exportFormatted
Export
booleanfalseEmit the DISPLAYED (formatted) measure values (each leaf's formatStr) in the export instead of raw numerics.
TensorPivot.exportLabel
Export
string'Export CSV'Label for the Export button.
TensorPivot.onExport
Export
(csv: string) => voidReceives the cross-tab CSV when the Export button is clicked.
TensorPivot.showExportButton
Export
booleanRender an opt-in Export button above the cross-tab. Clicking fires onExport with the CSV of the CURRENT view (core pivotToCsv over the displayed row tree + column defs). Callback-only.
TensorVirtualGrid.exportFormatted
Export
booleanfalseEmit FORMATTED measure values in the export instead of raw numerics (passes { format: true } to treeToCsv).
TensorVirtualGrid.exportLabel
Export
string'Export CSV'Label for the Export button.
TensorVirtualGrid.onExport
Export
(csv: string) => voidReceives the aggregated-tree CSV when the Export button is clicked.
TensorVirtualGrid.showExportButton
Export
booleanRender an opt-in Export button above the scroller. Clicking fires onExport with the CSV of the AGGREGATED roll-up AS SHOWN (filter + sort applied) via core treeToCsv. Callback-only.
MountHandle.setFilter
Filtering
setFilter(predicate: NodePredicate | null): voidPrune by a node predicate via core filterTree (ancestor paths kept); null clears. Composes with sort: filter first, then sort.
TensorGrid.enableColumnFilters
Filtering
booleanfalseShow a per-column filter row under the header: a control on the root dimension + a min/max range filter per measure column, applied client-side over the tree via core columnFilterPredicate (frontend does no math).
TensorGrid.having
Filtering
stringPost-aggregation group filter: a safe formula-DSL predicate over each node's MEASURES ('revenue > 1000' / 'revenue > cost * 1.5'); groups that fail are pruned (ancestor paths to a survivor kept), via core applyHaving. Blank/undefined = no filter.
TensorGrid.quickFilter
Filtering
stringCase-insensitive substring filter over the row dimensions (ancestor paths kept; a matching group keeps its breakdown). Blank/undefined = no filter.
TensorGrid.rootFilter
Filtering
RootFilterKind ('text' | 'select' | 'set' | 'conditions' | 'date')'text'The root-dimension control when enableColumnFilters: a substring 'text' box, a single-value 'select' dropdown, a multi-value 'set' checkbox list, or a 'conditions' operator builder. select/set list the root dimension's distinct source values (via core facetCounts). 'date' renders a from/to date-picker pair.
TensorPivot.enableColumnFilters
Filtering
booleanfalseShow a filter row under the header: a single control on the root ROW dimension, applied client-side over the row hierarchy via core columnFilterPredicate. Prunes which row groups appear. The pivoted COLUMN groups are the cross-tab's shape and are not filtered here.
TensorPivot.enableColumnGroupFilter
Filtering
booleanfalseShow a column-group picker in the corner header cell: a checkbox list of the outer column-dimension values (via core pivotColumnGroups). Unchecking a group hides that column group — a client-side DISPLAY prune (core filterPivotColumnDefs before layout). Does not re-aggregate; the grand-total column is always kept.
TensorPivot.rootFilter
Filtering
RootFilterKind'text'The root-row-dimension control variant when enableColumnFilters.
TensorVirtualGrid.enableColumnFilters
Filtering
booleanfalseShow a filter BAR above the scroller: a single root-dimension control, applied client-side over the tree via core columnFilterPredicate. Headerless windowed rows have no measure columns to align a range under, so this is the root control only.
TensorVirtualGrid.quickFilter
Filtering
stringCase-insensitive substring filter over the row dimensions.
TensorVirtualGrid.rootFilter
Filtering
RootFilterKind'text'The root-dimension control variant when enableColumnFilters.
GridMountOptions.groupHeader
Formatting
stringfirst dim's header override, or 'Group'Header for the auto-group column (vanilla grid mount specific; React uses headers[firstDim]).
TensorGrid.formats
Formatting
Record<string, string>Optional per-column formatStr overrides.
TensorGrid.headers
Formatting
Record<string, string>Optional per-column header overrides.
TensorGrid.locale
Formatting
string'en-US'BCP-47 locale for number/date formatting.
TensorPivot.formats
Formatting
Record<string, string>Optional per-measure formatStr overrides.
TensorPivot.groupHeader
Formatting
string'Group'Header for the auto-group (row hierarchy) column.
TensorPivot.locale
Formatting
string'en-US'BCP-47 locale for formatting.
TensorVirtualGrid.formats
Formatting
Record<string, string>Optional per-column formatStr overrides.
TensorVirtualGrid.headers
Formatting
Record<string, string>Optional per-column header overrides.
TensorVirtualGrid.locale
Formatting
string'en-US'BCP-47 locale for formatting.
mountTensorPivot *
Pivot
(el: HTMLElement, options: PivotMountOptions) => PivotMountHandleZero-dependency imperative mount of a cross-tab (core pivotGrid + renderPivotHtml) into el. Sorting is programmatic (handle.setSort by a cell accessor key). Returns PivotMountHandle (MountHandle + toCsv).
PivotMountOptions
Pivot
interface { data; rows; cols; measures; formats?; colSubtotals?; grandTotal?; rowGrandTotal?; pinFirstColumn?; groupHeader?; locale?; keptColumnGroups?; cellStyles?; colorScales?; dataBars?; iconSets?; cellRenderers?; showSearch?; searchPlaceholder?; noRowsMessage?; showExportButton?; onExport?; exportLabel?; exportFormatted? }Options object for mountTensorPivot. colSubtotals/grandTotal default true, rowGrandTotal defaults false. cellStyles/colorScales/dataBars/iconSets/cellRenderers keyed by MEASURE NAME.
PivotMountOptions.keptColumnGroups
Pivot
string[]undefined/[] = show allColumn-group display prune: keep only these outer column-dimension group headers (e.g. ['2024']). The imperative parallel to setFilter for rows — drive via handle.update({ keptColumnGroups }). A hidden column's data still counts toward the grand-total column (a display prune via core filterPivotColumnDefs, not re-aggregation). Enumerate headers with core pivotColumnGroups(pivotGrid(...).column_defs).
TensorPivot *
Pivot
(props: TensorPivotProps) => ReactElementReact symmetric cross-tab component over core pivotGrid. Props are raw data + row/column dimensions + measures; computes the whole pivot client-side, lays out nested column groups via layoutPivotHeader, and renders a multi-row header + click-to-expand row hierarchy.
TensorPivot.cols *
Pivot
string[]Column dimension columns (pivoted into nested groups), outer -> inner.
TensorPivot.colSubtotals
Pivot
booleantrueEmit a subtotal column at each non-leaf column level.
TensorPivot.grandTotal
Pivot
booleantrueEmit a grand-total column group.
TensorPivot.rowGrandTotal
Pivot
booleanfalsePrepend a synthetic top 'Total' ROW aggregating across all row groups (the symmetric partner of the grand-total column).
Vue TensorPivot
Pivot
defineComponent; props: TensorPivotPropsVue 3 cross-tab adapter over core pivotGrid. Prop interface identical to React TensorPivotProps (data, apiRef, rows, cols, measures, formats, colSubtotals=true, grandTotal=true, rowGrandTotal=false, pinFirstColumn=false, groupHeader='Group', locale='en-US', enableColumnFilters=false, rootFilter='text', showSearch, searchPlaceholder, enableColumnGroupFilter=false, cellStyles [by measure name], colorScales, dataBars, iconSets, cellRenderers, noRowsMessage, showExportButton, onExport, exportLabel, exportFormatted). Vue delta: cellRenderers return VNodeChild.
MountHandle.applyState
Saved-views
applyState(state: GridViewState): voidRestore a (partial) view state produced by getState — only the axes present in state change; the rest are untouched. Re-renders once.
MountHandle.getState
Saved-views
getState(): GridViewStateCapture the current serializable VIEW state (expansion / sort / search / hidden columns / density / widths / selection) for a saved view or preset. Round-trips through applyState.
TensorGrid.apiRef
Saved-views
{ current: TensorGridApi | null }Optional imperative API handle: pass a mutable ref object ({ current: null }) and the component fills .current with { getState, applyState, setColumnOrder } for saved views / presets. Read-only from the host's side; the host persists the captured state and calls applyState to restore it.
TensorGridApi
Saved-views
{ getState(): GridViewState; applyState(state: GridViewState): void; setColumnOrder(order: string[] | null): void }Imperative saved-view API written to props.apiRef.current: getState captures the serializable VIEW state (expansion / sort / search / hidden columns / density / widths / selection / columnOrder); applyState restores a partial preset (only the axes present in state change); setColumnOrder sets the measure-column display order (null/[] restores natural order).
TensorPivot.apiRef
Saved-views
{ current: TensorPivotApi | null }Optional imperative API handle filled with { getState, applyState } for saved views / presets (expansion / sort / column-group prune).
TensorPivotApi
Saved-views
{ getState(): GridViewState; applyState(state: GridViewState): void }Imperative saved-view API for the pivot (props.apiRef.current): capture / restore the serializable view state (expansion / sort / the kept column-group prune). No column reorder — the pivot's column order is fixed by the cross-tab.
TensorVirtualGrid.apiRef
Saved-views
{ current: TensorVirtualGridApi | null }Opt-in imperative API: a stable { getState, applyState } written to apiRef.current for saved views / presets (capture & restore the expand state the host cannot otherwise reach).
TensorVirtualGridApi
Saved-views
{ getState(): GridViewState; applyState(state: GridViewState): void }Imperative saved-view API on props.apiRef.current. The virtual grid owns only the EXPAND axis internally, so getState captures { expanded } and applyState restores it — a partial GridViewState cross-compatible with a full grid's preset.
MountHandle.clearSelection
Selection
clearSelection(): voidEmpty the selection.
MountHandle.getSelected
Selection
getSelected(): string[]Selected node ids (ctrl/meta-click toggles a row; plain click keeps expand behavior).
TensorGrid.clearSelectionLabel
Selection
string'Clear'Label for the 'Clear' button.
TensorGrid.onSelectionChange
Selection
(ids: string[]) => voidFired after every ctrl/meta-click selection toggle with the selected node ids. Compose export with core helpers: toCsv(rowsForSelection(data, rows, ids.map(id => ({id})))).
TensorGrid.selectAllLabel
Selection
string'Select all'Label for the 'Select all' button.
TensorGrid.showSelectionToolbar
Selection
booleanRender an opt-in .tg-selection-toolbar above the grid with 'Select all' / 'Clear' buttons. Select all selects every currently-visible row; Clear empties the selection. Both fire onSelectionChange.
MountHandle.setSort
Sorting
setSort(by: string | null, desc?: boolean): voidSort siblings by a single column key; null restores engine order (equivalent to setSortKeys([{ by, desc }])).
MountHandle.setSortKeys
Sorting
setSortKeys?(keys: SortKey[]): voidMulti-column sort via core sortTreeMulti: siblings order by the first key, ties broken by each subsequent key ([] restores engine order). Present on the grid + pivot mounts (the flat virtual grid omits it).
TensorVirtualGrid.sortBy
Sorting
stringSibling sort column (pure re-order via core sortTree).
TensorVirtualGrid.sortDesc
Sorting
booleanfalseSibling sort direction.
mountVirtualGrid *
Virtualization
(el: HTMLElement, options: VirtualGridOptions) => MountHandle<VirtualGridOptions>Zero-dependency imperative mount of a windowed scroller (core flattenTreeWindow): a spacer sized total×rowHeight + an absolutely-positioned window re-rendered directly on scroll (O(window) per event). Returns the control handle.
TensorVirtualGrid *
Virtualization
(props: TensorVirtualGridProps) => ReactElementReact windowed (virtual-scroll) grid over core, mirroring the vanilla mountVirtualGrid geometry: a spacer sized total×rowHeight + an absolutely-positioned window rendered from flattenTreeWindow (O(window) DOM rows). Display pipeline is filter (quickFilter over row dims) then sort.
TensorVirtualGrid.height
Virtualization
number480Scroller height in px.
TensorVirtualGrid.overscan
Virtualization
number4Extra rows rendered above/below the viewport.
TensorVirtualGrid.rowHeight
Virtualization
number28Fixed row height in px.
VirtualGridOptions
Virtualization
interface extends Omit<GridMountOptions, 'showDensityToggle'|'density'|'onDensityChange'> { rowHeight?; height?; overscan?; sortBy?; sortDesc? }Options object for mountVirtualGrid. Inherits all GridMountOptions except the density toggle (fixed rowHeight), plus rowHeight (default 28), height (default 480), overscan (default 4), sortBy (initial sibling sort column), sortDesc (default false). Supports the same opt-in autoGroup.
Vue TensorVirtualGrid
Virtualization
defineComponent; props: TensorVirtualGridPropsVue 3 windowed grid over core flattenTreeWindow. Prop interface identical to React TensorVirtualGridProps (data, apiRef, rows, measures, formats, headers, grandTotal, locale, quickFilter, showSearch, searchPlaceholder, enableColumnFilters, rootFilter, cellStyles, colorScales, dataBars, iconSets, sparklines, cellRenderers, sortBy, sortDesc, height=480, rowHeight=28, overscan=4, noRowsMessage, showFooter, footerLabel, showExportButton, onExport, exportLabel, exportFormatted). Vue delta: cellRenderers return VNodeChild.
TensorGrid.windowColumns
Window
WindowColumnSpec[]Derived read-only measure columns computed over the built tree via oracle-verified core transforms (runningTotal / rank / pctOfTotal / pctOfParent / delta / movingAverage). Each writes into key `as` and appears as an extra measure column after the base measures.