Skip to content

BlockConfigInput

Defined in: packages/core/src/fields/blocks/types.ts:91

Configuration input for a single block type, passed to defineBlock().

A block definition describes one variant in a blocks field — its stored discriminant (slug), its display name in the admin picker (label), the fields that make up its data shape, and optional admin UI config (icon). Three fields are injected automatically on every block item and must not appear in fields: blockType, blockName, and id.

Defaults applied by defineBlock():

{
interfaceName: slugToPascalCase(slug) + "Block", // e.g. "heading" → "HeadingBlock"
}
const headingBlock = defineBlock({
slug: "heading",
label: "Heading",
admin: { icon: "heading" },
fields: {
level: select({ options: [{ label: "H1", value: "h1" }] }),
text: text({ required: true }),
},
})

optional admin?: BlockAdminConfig

Defined in: packages/core/src/fields/blocks/types.ts:113

Admin UI configuration (picker icon).


fields: Record<string, AdminField>

Defined in: packages/core/src/fields/blocks/types.ts:111

Fields that make up this block’s data shape.

Accepts any AdminField, including nested group() or array(). blockType, blockName, and id are injected automatically — do not include them here. defineBlock() throws if any reserved name is used.


optional interfaceName?: string

Defined in: packages/core/src/fields/blocks/types.ts:119

Custom TypeScript interface name for this block type.

Defaults to ${slugToPascalCase(slug)}Block (e.g. "heading""HeadingBlock").


optional label?: string

Defined in: packages/core/src/fields/blocks/types.ts:103

Display label shown in the admin block-type picker and as the block header.


optional name?: string

Defined in: packages/core/src/fields/blocks/types.ts:101


slug: string

Defined in: packages/core/src/fields/blocks/types.ts:100

Unique identifier for this block type.

Stored as blockType: "slug" on every block item. Used as the Convex v.literal() discriminant and Zod z.literal() key. Must start with a letter and contain only letters, numbers, hyphens, and underscores (/^[a-zA-Z][a-zA-Z0-9_-]*$/).