Skip to content

ArrayFieldInput

Defined in: packages/core/src/fields/array/types.ts:62

Configuration input for an array() field.

Array fields store ordered lists of values — strings, numbers, booleans, or nested objects. The items property defines the type of each element using any VexCMS field builder (including nested array() for multi-dimensional arrays). All properties are optional; unset properties fall back to the defaults listed below.

Defaults applied by array():

{
type: "array",
label: "", // inferred from the field key by defineCollection
labels: { singular: "Item", plural: "Items" },
required: false, // field is optional by default
defaultValue: [], // empty array shown in admin form
admin: {
hidden: false, // visible in the admin form
readOnly: false, // editable by default
position: "main", // placed in the main content column, not the sidebar
width: "full", // spans the full form width, not half
cellAlignment: "left", // item count aligned left in the data table column
}
}
// String tags — label inferred from key ("Tags")
tags: array({ items: text() })
// Required number array with max length
scores: array({ required: true, items: number(), max: { value: 10 } })
// Nested array — array of arrays of numbers (2D matrix)
matrix: array({ items: array({ items: number() }) })
// Object items — each item is a structured sub-document
links: array({
items: object({
label: text(),
href: url(),
}),
})

BaseFieldInput for shared properties (label, description, required, admin, index, searchIndex)

TArrayType extends ArrayType = string

TFieldMeta extends object = { }

optional admin?: FieldAdminConfigInput

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

Admin UI configuration for this field.

BaseFieldInput.admin


optional defaultValue?: TArrayType[]

Defined in: packages/core/src/fields/array/types.ts:75

Pre-filled value shown in the admin form when creating a new field. Does not apply to database values

BaseFieldInput.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.

BaseFieldInput.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"])

BaseFieldInput.index


optional interfaceDescription?: string

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

The JSDoc comment on the generated document interface property

BaseFieldInput.interfaceDescription


items: AdminField

Defined in: packages/core/src/fields/array/types.ts:76


optional label?: string

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

Display label for the field in the admin form.

BaseFieldInput.label


optional labels?: object

Defined in: packages/core/src/fields/array/types.ts:66

plural: string

singular: string


optional max?: object

Defined in: packages/core/src/fields/array/types.ts:85

Maximum array length config.

optional error?: string

Maximum array length error message.

value: number

Maximum array length.


optional meta?: TFieldMeta

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

BaseFieldInput.meta


optional min?: object

Defined in: packages/core/src/fields/array/types.ts:78

Minimum array length config.

optional error?: string

Minimum array length error message.

value: number

Minimum array length.


optional required?: boolean

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

Whether this field is required.

Default: false

BaseFieldInput.required