array
array<
TCollectionSlug,TFieldKey,TArrayType,TFieldMeta>(options):ArrayField<TCollectionSlug,TArrayType,TFieldMeta>
Defined in: packages/core/src/fields/array/config.ts:62
Creates an array field with all defaults applied.
Array fields store ordered lists of values — strings, numbers, booleans,
or nested objects. Items are validated by a nested field definition
(items) which supports any VexCMS field type including nested arrays.
Accepts ArrayFieldInput (all optional) and returns ArrayField with all defaults applied.
Defaults applied:
label—""(inferred from the field key bydefineCollection); the admin UI uses it as the plural (“Grid Items”) anditems.labelas the singular (“Grid Item”) — see arrayItemLabelrequired—falsedefaultValue—[]admin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"100%"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TArrayType
Section titled “TArrayType”TArrayType extends ArrayType = string
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options
Section titled “options”ArrayFieldInput<TCollectionSlug, TFieldKey, TArrayType, TFieldMeta>
Array field configuration. All properties are optional.
Returns
Section titled “Returns”ArrayField<TCollectionSlug, TArrayType, TFieldMeta>
Resolved array field definition with all defaults applied.
Example
Section titled “Example”import { array, text, defineCollection } from '@vexcms/core'
posts: defineCollection({ fields: { // Simple string tags array tags: array({ items: text(), }),
// Number array with a min length scores: array({ items: number(), min: 1, }),
// Nested array — array of arrays of numbers matrix: array({ items: array({ items: number() }), }), }})- ArrayFieldInput for the full input type
- ArrayField for the resolved output type