Skip to content

defineBlock

defineBlock(options): BlockConfig

Defined in: packages/core/src/fields/blocks/config.ts:36

Defines a single block type for use in a blocks() field.

Validates that the slug is a valid identifier and that no field name collides with framework-reserved names (blockType, blockName, id). Computes interfaceType — the TypeScript object-type string including all three framework keys plus user fields.

BlockConfigInput

Block definition. slug, label, and fields are required.

BlockConfig

Resolved BlockDef with all defaults applied.

If slug does not match /^[a-zA-Z][a-zA-Z0-9_-]*$/.

If any field name is in RESERVED_BLOCK_FIELD_NAMES.

const headingBlock = defineBlock({
slug: "heading",
label: "Heading",
admin: { icon: "heading" },
fields: { text: text({ required: true }) },
})