# createNestedTableLevel

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

## API

### Overview

A helper function that creates a [`NestedTableLevel`](./?path=/story/base-components-collections-nestedtable--nestedtablelevel) descriptor without specifying `depth` (depth is assigned automatically based on array position). Pass the result to the `levels` array in [`useNestedTable`](./?path=/story/base-components-collections-nestedtable-usenestedtable--usenestedtable).

### Props

| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `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. |
| `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 |
| `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. |
| `renderMainColumn` | `RenderMainColumn<T>` | No | - | Render logic of the main column for this level. T) => { title?: string; subtitle?: string; image?: ReactNode; } |
| `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. |
| `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 |

