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

# defineTextBlock

> **defineTextBlock**\<`TType`\>(`config`): [`TextBlock`](/api/editor/type-aliases/textblock/)

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

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

`type` is required even though the top-level text block type is
always `'block'`. Keeping `type` required leaves the door open for
positional overrides of text-block-like elements (e.g. a `code-line`
inside a `code-block` container).

:::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

#### of?

readonly ([`Span`](/api/editor/type-aliases/span/) \| [`InlineObject`](/api/editor/type-aliases/inlineobject/))[]

#### render?

[`TextBlockRender`](/api/editor/type-aliases/textblockrender/)

#### type

`TType` *extends* `"span"` ? `"Error: defineTextBlock({type: 'span'}) is forbidden -- 'span' is always a span, use defineSpan"` : `TType`

## Returns

[`TextBlock`](/api/editor/type-aliases/textblock/)

## Example

```ts
defineTextBlock({
  type: 'block',
  render: ({attributes, children}) => (
    <p {...attributes}>{children}</p>
  ),
})
```