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.
Parameters
Section titled “Parameters”options
Section titled “options”Block definition. slug, label, and fields are required.
Returns
Section titled “Returns”Resolved BlockDef with all defaults applied.
Throws
Section titled “Throws”If slug does not match /^[a-zA-Z][a-zA-Z0-9_-]*$/.
Throws
Section titled “Throws”If any field name is in RESERVED_BLOCK_FIELD_NAMES.
Example
Section titled “Example”const headingBlock = defineBlock({ slug: "heading", label: "Heading", admin: { icon: "heading" }, fields: { text: text({ required: true }) },})- BlockConfigInput for the full input type
- BlockConfig for the resolved output type