Skip to content

BlocksFieldInput

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

Configuration input for a blocks() field.

Blocks fields store an ordered, heterogeneous list of typed objects. Each item carries blockType (which block definition it matches), id (stable UUID), blockName (user-editable label), plus the fields from that block’s definition.

Defaults applied by blocks():

{
type: "blocks",
label: "", // inferred from field key by defineCollection
required: false,
defaultValue: [],
labels: { singular: "block", plural: "blocks" },
admin: {
hidden: false, readOnly: false, position: "main", width: "full",
cellAlignment: "left",
}
}
body: blocks({
label: "Body",
blocks: [headingBlock, paragraphBlock],
})
// Named union alias + min/max constraints
body: blocks({
label: "Body",
interfaceName: "PageBlock",
blocks: [headingBlock, paragraphBlock],
min: 1,
max: 20,
labels: { singular: "section", plural: "sections" },
})
  • BlocksField for the resolved output type
  • blocks for the config function that produces this type

TFieldMeta extends object = { }

optional admin?: FieldAdminConfigInput & object

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

optional defaultCollapsed?: boolean


blocks: BlockConfig<TFieldMeta>[]

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

Block type definitions that are allowed in this field.


optional defaultValue?: Record<string, unknown>[]

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

Pre-filled value when creating a new document. Defaults to [].

RelationshipFieldInput.defaultValue


optional description?: string

Defined in: packages/core/src/fields/baseTypes.ts:194

Semantic description of the field. Used in three places:

  1. Helper text rendered below the field input in the admin form UI.
  2. As the Zod .meta({ description }) value for form validation.
  3. As the JSDoc comment on the generated document interface property.

To write a separate JSDoc comment, use interfaceDescription in addition.

UploadFieldInput.description


optional index?: string

Defined in: packages/core/src/fields/baseTypes.ts:220

Create a database index on this field. The string value becomes the index name in Convex.

slug: { type: "text", index: "by_slug", required: true }
// Generates: .index("by_slug", ["slug"])

UploadFieldInput.index


optional interfaceDescription?: string

Defined in: packages/core/src/fields/baseTypes.ts:196

The JSDoc comment on the generated document interface property

UploadFieldInput.interfaceDescription


optional interfaceName?: string

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

Optional TypeScript union alias name.

When set, emits export type PageBlock = HeadingBlock | ParagraphBlock and the collection interface uses PageBlock[] instead of the inline union.


optional label?: string

Defined in: packages/core/src/fields/baseTypes.ts:185

Display label for the field in the admin form.

UploadFieldInput.label


optional labels?: object

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

Singular/plural display labels used in the admin UI. Defaults to { singular: "block", plural: "blocks" }.

plural: string

singular: string


optional max?: number

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

Maximum number of block items.

Enforced by the Zod inputSchema. When the max is reached, the “Add” button is disabled in the admin UI.


optional meta?: TFieldMeta

Defined in: packages/core/src/fields/baseTypes.ts:221

Omit.meta


optional min?: number

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

Minimum number of block items.

Enforced by the Zod inputSchema (form validation), not the Convex schema. Does not affect the generated vex.schema.ts.


optional required?: boolean

Defined in: packages/core/src/fields/baseTypes.ts:202

Whether this field is required.

Default: false

UploadFieldInput.required