Skip to content

BaseFieldInput

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

Properties shared by all field types.

Every field type (text, number, checkbox, etc.) extends this interface with its own type discriminant and type-specific options. These base properties control labeling, validation, admin UI behavior, and database indexing.

Defaults applied by field config functions:

{
label: "", // inferred from the field key by defineCollection
required: false, // field is optional in the database schema
admin: { ... } // see FieldAdminConfigInput for admin defaults
}

BaseField for the resolved type after defaults are applied

TCollectionSlug extends VexResourceSlug = VexResourceSlug

TFieldKey extends string = never

TFieldMeta extends object = { }

optional admin?: FieldAdminConfigInput<TCollectionSlug, ComponentHKT>

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

Admin UI configuration for this field.


optional defaultValue?: unknown

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

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


optional description?: string

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

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.


optional index?: FieldIndexConfigInput<TCollectionSlug, TFieldKey>

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

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"])
author: { type: "relationship", index: { name: "by_author_status", additionalFields: ["status"] } }
// Generates: .index("by_author_status", ["author", "status"])

optional interfaceDescription?: string

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

The JSDoc comment on the generated document interface property


optional label?: string

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

Display label for the field in the admin form.


optional meta?: TFieldMeta

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


optional required?: boolean

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

Whether this field is required.

Default: false

optional validate(props): void | Promise<void>

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

Server-only async validation, run after the generated Zod schema passes.

FieldValidateProps<TCollectionSlug>

void | Promise<void>

FieldValidate