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", }}Examples
Section titled “Examples”body: blocks({ label: "Body", blocks: [headingBlock, paragraphBlock],})// Named union alias + min/max constraintsbody: 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
Extends
Section titled “Extends”Omit<BaseFieldInput<TFieldMeta>,"admin">
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput&object
Defined in: packages/core/src/fields/blocks/types.ts:205
Type Declaration
Section titled “Type Declaration”defaultCollapsed?
Section titled “defaultCollapsed?”
optionaldefaultCollapsed?:boolean
blocks
Section titled “blocks”blocks:
BlockConfig<TFieldMeta>[]
Defined in: packages/core/src/fields/blocks/types.ts:209
Block type definitions that are allowed in this field.
defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:Record<string,unknown>[]
Defined in: packages/core/src/fields/blocks/types.ts:234
Pre-filled value when creating a new document. Defaults to [].
Overrides
Section titled “Overrides”RelationshipFieldInput.defaultValue
description?
Section titled “description?”
optionaldescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:194
Semantic description of the field. Used in three places:
- Helper text rendered below the field input in the admin form UI.
- As the Zod
.meta({ description })value for form validation. - As the JSDoc comment on the generated document interface property.
To write a separate JSDoc comment, use interfaceDescription in addition.
Inherited from
Section titled “Inherited from”index?
Section titled “index?”
optionalindex?: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.
Example
Section titled “Example”slug: { type: "text", index: "by_slug", required: true }// Generates: .index("by_slug", ["slug"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:196
The JSDoc comment on the generated document interface property
Inherited from
Section titled “Inherited from”UploadFieldInput.interfaceDescription
interfaceName?
Section titled “interfaceName?”
optionalinterfaceName?: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.
label?
Section titled “label?”
optionallabel?:string
Defined in: packages/core/src/fields/baseTypes.ts:185
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”labels?
Section titled “labels?”
optionallabels?: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
Section titled “plural”plural:
string
singular
Section titled “singular”singular:
string
optionalmax?: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.
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:221
Inherited from
Section titled “Inherited from”Omit.meta
optionalmin?: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.
required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:202
Whether this field is required.
Default: false