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

# defineSpan

> **defineSpan**\<`TType`\>(`config`): [`Span`](/api/editor/type-aliases/span/)

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

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

`type` is required even though there is only one top-level span type
(`'span'`) today. Keeping `type` required leaves the door open for
positional overrides of span-like inlines (e.g. a `code-span` 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

#### render?

[`SpanRender`](/api/editor/type-aliases/spanrender/)

#### type

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

## Returns

[`Span`](/api/editor/type-aliases/span/)

## Example

```ts
defineSpan({
  type: 'span',
  render: ({attributes, children}) => (
    <span {...attributes}>{children}</span>
  ),
})
```