# NestedTableNodeState

**Category:** Base Components/Collections/NestedTable

## API

### Overview

`NestedTableNodeState` represents a single node in a [`NestedTable`](./?path=/story/base-components-collections-nestedtable--nestedtable) tree. Each node has a `depth`, `expanded` state, `children` collection, `optimisticActions`, and access to its parent via `getParent()`. Use `getData()` to access the item and `toggleExpand()` to expand/collapse.

### Props

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `getParent` | `<TD, FD extends FiltersMap>() => NestedTableNodeStatePublicAPI<C, TD, FD> \| null` | Yes | - | Get the node this node is a child of => [NestedTableNodeState](./?path=/story/base-components-collections-nestedtable--nestedtablenodestate) \| `undefined` |
| `children` | `CollectionState<T, F>` | No | - | The collection of the node |
| `optimisticActions` | `NestedTableNodeStateOptimisticActionsPublicAPI<T>` | No | - | The optimistic actions of the node, affects items both in nested & flat mode |
| `getData` | `<TD>() => TD \| null` | Yes | - | The "parent" item of this node => T \| null |
| `toggleExpand` | `() => void` | Yes | - | Toggle the expand/collapse state of the node |
| `expanded` | `boolean` | Yes | - | Whether the node is expanded |
| `depth` | `number` | Yes | - | The depth of the node in the tree |
| `getDescendants` | `<TD, FD extends FiltersMap>() => NestedTableNodeStatePublicAPI<C, TD, FD>[]` | Yes | - | Get all the nodes that are descendants of this node from all levels => [NestedTableNodeState](./?path=/story/base-components-collections-nestedtable--nestedtablenodestate)[] |

