API Reference > ui-components > Tree > MutableTreeModel MutableTreeModel Class Beta Mutable tree model which holds nodes and allows adding or removing them. Implements TreeModel Methods Name Description clearChildren(parentId: string | undefined): void Removes all children for parent specified by id. computeVisibleNodes(): VisibleTreeNodes Generates flat list of visible nodes in the tree model. getChildOffset(parentId: string | undefined, childId: string): number | undefined Returns children offset in children array for specific parent. getChildren(parentId: string | undefined): SparseArray<string> | undefined Returns children for specific parent. getNode(id: string): MutableTreeModelNode | undefined Returns tree node or placeholder for node that is not loaded yet. getNode(parentId: string | undefined, childIndex: number): MutableTreeModelNode | TreeModelNodePlaceholder | undefined getRootNode(): TreeModelRootNode Returns root node of a tree. insertChild(parentId: string | undefined, childNodeInput: TreeModelNodeInput, offset: number): void Inserts child in the specified position. iterateTreeModelNodes(parentId?: string): IterableIterator<MutableTreeModelNode> Iterates over all nodes present in the tree model. removeChild(parentId: string | undefined, childId: string): void Removes children specified by id. setChildren(parentId: string | undefined, nodeInputs: TreeModelNodeInput[], offset: number): void Sets children for parent node starting from the specific offset. setNumChildren(parentId: string | undefined, numChildren: number): void Sets number of how many child nodes the parent will have. Properties Name Type Description [immerable] Static boolean Defined in ui/components/src/ui-components/tree/controlled/TreeModel.ts Line 195 Last Updated: 13 June, 2024