> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# defineContainer

> **defineContainer**\<`TType`\>(`config`): [`Container`](/api/editor/type-aliases/container/)

Defined in: packages/editor/src/renderers/renderer.types.ts:344

Define a container renderer. The returned registration is mounted via
the `<NodePlugin>` component at the top level, or nested inside
another container's `of` array as a positional override.

`type` cannot be `'span'` (use [defineSpan](/api/editor/functions/definespan/)) nor `'block'` (use
[defineTextBlock](/api/editor/functions/definetextblock/)). The text block is not a container.

The `node` argument of `render` narrows to a portable text object.

:::caution[Alpha]
This API should not be used in production and may be trimmed from a public release.
:::

## Type Parameters

### TType

`TType` *extends* `string`

## Parameters

### config

#### arrayField

`string`

#### of?

readonly ([`Container`](/api/editor/type-aliases/container/) \| [`TextBlock`](/api/editor/type-aliases/textblock/) \| [`BlockObject`](/api/editor/type-aliases/blockobject/))[]

#### render?

(`props`) => `ReactElement`

#### type

`TType` *extends* `"span"` ? `"Error: defineContainer({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan"` : `TType` *extends* `"block"` ? `"Error: defineContainer({type: 'block'}) is forbidden -- 'block' is always a text block, use defineTextBlock"` : `TType` *extends* `"*"` ? `"Error: defineContainer({type: '*'}) is forbidden -- containers cannot be registered by wildcard"` : `TType`

## Returns

[`Container`](/api/editor/type-aliases/container/)

## Example

```ts
defineContainer({
  type: 'table',
  arrayField: 'rows',
  render: ({children}) => (
    <table>{children}</table>
  ),
  of: [
    defineContainer({
      type: 'row',
      arrayField: 'cells',
      render: ({children}) => (
        <tr>{children}</tr>
      ),
    }),
  ],
})
```