# NestedTableLevel

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

## API

### Overview

Describes a single level in a [`NestedTable`](./?path=/story/base-components-collections-nestedtable--nestedtable) hierarchy. Each level defines how its items are fetched (`createCollection`), how they relate to parents (`parentKey`), and how they render (`columns`, `renderMainColumn`, `actionCell`). Supports expandability, breadcrumbs, drag-and-drop, and row highlighting.

### Props

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `columns` | `Partial<Record<C, (row: T, rowNum: number) => ReactNode>>` | No | - | Render logic of the cells for this level. By default, all cells will be empty |
| `renderMainColumn` | `RenderMainColumn<T>` | No | - | Render logic of the main column for this level. T) => { title?: string; subtitle?: string; image?: ReactNode; } |
| `actionCell` | `ActionCell<T, F>` | No | - | A table's last column. Use this column to add an action at the end of each row. For example, a delete button to delete an item. Pass an [`ActionCellProps`](https://www.docs.wixdesignsystem.com/?path=/story/components-lists-table--tableactioncell) object, or a function that returns an `ActionCellProps` object. |
| `breadcrumbs` | `((item: T) => { id: string; name: string; }[] \| null)` | No | - | A function that accepts the item of the current level and returns an array of breadcrumbs to be displayed in the toolbar. Each breadcrumb is an object with `id` and `name` properties. `fetchData` will be called with `query.fields` that contains the value `breadcrumbs` to signal that the breadcrumbs should be fetched. |
| `expandable` | `((item: T) => boolean)` | No | - | A function that accepts the item of the current level and returns a boolean value that indicates whether the item can be expanded. By default, all items are expandable. |
| `isRowHighlight` | `((item: T) => boolean)` | No | - | A function that accepts the item of the current level and returns a boolean value indicating whether the item should be highlighted. |
| `parentKey` | `(item: T) => string \| null \| undefined` | Yes | - | A function that accepts the item of the current level and returns the key of the parent item, for example: `(item) => item.parentId`. |
| `createCollection` | `(params?: NestedOptimisticActionsState<T, F> \| undefined) => { collection: CollectionState<T, F>; parentFilter?: Filter<...> \| undefined; }` | Yes | - | A function that creates a collection for the current level (using [useCreateCollection](./?path=/story/common-hooks--usecreatecollection) hook), and returns the collection state and a reference to a filter object within this collection that filters the collection by the parent key. => { collection: [CollectionState](./?path=/story/common-state--collectionstate); parentFilter?: [Filter<string[]>](./?path=/story/features-filter-factories--stringsarrayfilter); } |
| `optimisticActionsPredicate` | `((query: ComputedQuery<F>) => (item: T) => boolean)` | No | - | A [predicate](./?path=/story/features-actions-updates--useoptimisticactions) function to pass to the internal [OptimisticActions](/?path=/story/features-actions-updates--collectionoptimisticactions) created by NestedTable |

