Skip to content

Shared Types

All types are available from the root or sub-path imports.

GridColumn

ts
import type { GridColumn } from '@itsmemyk/react-tree-grid/grid'
FieldTypeDescription
idstringMatches a key in row data (required)
headerGridHeaderCell[]Header row cells
footerGridFooterCell[]Footer row cells
widthnumberFixed column width in px
minWidthnumberMinimum resize width
maxWidthnumberMaximum resize width
hiddenbooleanHide column
sortablebooleanEnable sort on this column
resizablebooleanEnable resize handle
typeGridColumnTypeValue type for render and sort
editorTypeGridEditorTypeEditor widget when editable is on
template(value, row, col) => ReactNodeCustom cell renderer
align'left' | 'center' | 'right'Cell text alignment
adjustboolean | 'data' | 'header' | 'footer'Per-column auto-fit
autoWidthbooleanParticipate in auto-width distribution
tooltipbooleanOverride grid-level tooltip for this column
tooltipTemplate(value, row, col) => string | nullCustom tooltip content
markGridMarkConfigAuto-apply CSS class based on value range or function

GridRow

ts
import type { GridRow } from '@itsmemyk/react-tree-grid/grid'
FieldTypeDescription
idstringUnique identifier (required)
hiddenbooleanHide row without removing from data
$heightnumberOverride row height in px
$cssstringExtra CSS class on this row
[key: string]unknownAny additional data fields

TreeGridRow

ts
import type { TreeGridRow } from '@itsmemyk/react-tree-grid/treegrid'

Extends GridRow with:

FieldTypeDescription
parentstringParent row ID (flat structure)
itemsTreeGridRow[]Nested children (nested structure)
$openedbooleanStart node expanded

TreeNode

ts
import type { TreeNode } from '@itsmemyk/react-tree-grid/tree'
FieldTypeDescription
idstringUnique identifier (required)
valuestringDisplay label (required)
iconReactNodeCustom icon
itemsTreeNode[]Child nodes
disabledbooleanDisable interaction
$openedbooleanStart expanded

GridSpan

ts
import type { GridSpan } from '@itsmemyk/react-tree-grid/grid'

interface GridSpan {
  row: string       // row ID
  column: string    // column ID (top-left cell of span)
  rowspan?: number  // rows to span
  colspan?: number  // columns to span
  text?: string     // override cell text
  css?: string      // extra CSS class
  tooltip?: string  // tooltip text
}

SortState

ts
interface SortState {
  columnId: string
  order: 'asc' | 'desc'
}

Released under the MIT License.