Skip to content

defineCollection

defineCollection<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields>(config): CollectionConfig<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields>

Defined in: packages/react/src/index.ts:342

Defines a collection with React-typed component slots.

Drop-in replacement for @vexcms/core’s defineCollection — same behaviour, but admin.components.preview is typed as a React ComponentType<RelationshipPreviewProps<TCollectionSlug>>.

The parameter type is derived from core’s own signature rather than restated, so core’s reserved-field-key guard (naming a field updatedAt is a compile error) reaches callers of this wrapper too, and cannot drift from it.

TFieldMeta extends object = { }

TCollectionMeta extends object = { }

TCollectionSlug extends string = string

TFields extends Record<string, AdminField<TFieldMeta>> = Record<string, AdminField<TFieldMeta>>

string extends keyof TFields ? CollectionConfigInput<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields, ReactHKT, false, true> : [keyof TFields & "vex_status" | "vex_publishedAt" | "vex_publishedId" | "vex_activeVersion" | "updatedAt"] extends [never] ? CollectionConfigInput<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields, ReactHKT, false, true> : object

Collection configuration.

CollectionConfig<TFieldMeta, TCollectionMeta, TCollectionSlug, TFields>

The resolved collection configuration.