Skip to content

Interface: UseTreeEditorOptions\<TRow\>

Defined in: src/tree-editor/use-tree-editor.ts:25

Configuration for useTreeEditor — the hook that turns a tree grid into a fully-editable hierarchy with add/delete/move/reorder/indent/outdent, clipboard, drag-drop, and multi-level undo/redo.

Type Parameters

TRow

TRow

Properties

createNode?

optional createNode?: (parentId) => TRow

Defined in: src/tree-editor/use-tree-editor.ts:33

Optional row-data factory for addNode when data is omitted.

Parameters

parentId

string | null

Returns

TRow


generateId?

optional generateId?: () => string

Defined in: src/tree-editor/use-tree-editor.ts:31

Generate ids for new and pasted nodes. Required for addNode / paste.

Returns

string


historyDepth?

optional historyDepth?: number

Defined in: src/tree-editor/use-tree-editor.ts:35

Maximum undo history depth (default 50).


initialState

initialState: TreeState<TRow>

Defined in: src/tree-editor/use-tree-editor.ts:27

Initial tree state.


onTreeChange?

optional onTreeChange?: (state, changeSet) => void

Defined in: src/tree-editor/use-tree-editor.ts:40

Called after any successful tree mutation, including undo/redo and paste. Receives the new state and the current change set.

Parameters

state

TreeState<TRow>

changeSet

ChangeSet<TRow>

Returns

void


validateMove?

optional validateMove?: MoveValidator<TRow>

Defined in: src/tree-editor/use-tree-editor.ts:29

Optional move validator (in addition to built-in cycle/self check).