Skip to content

defineSpan

defineSpan<TType>(config): Span

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

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).

TType extends string

SpanRender | null

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

Span

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