Skip to content

FieldDefinition

FieldDefinition = object

Defined in: packages/forms/src/types.ts:82

A field definition produced by introspectTable, describing a single form field.

Contains all metadata needed to render and validate a field: input type, label, required status, enum options, and validation rules derived from both the Drizzle schema and any rules attached via v.

optional enumValues: string[]

Defined in: packages/forms/src/types.ts:96

Available options for enum/select fields, copied from the Drizzle column definition.


hasDefault: boolean

Defined in: packages/forms/src/types.ts:92

Whether the column has a default value defined in the schema.


inputType: InputType

Defined in: packages/forms/src/types.ts:86

The resolved input type based on the Drizzle column type.


isPrimaryKey: boolean

Defined in: packages/forms/src/types.ts:94

Whether the column is the table’s primary key.


label: string

Defined in: packages/forms/src/types.ts:88

Human-readable label derived from the column name (e.g., "Author Id" from "authorId").


name: string

Defined in: packages/forms/src/types.ts:84

The column key from the Drizzle table (e.g., "title", "authorId").


required: boolean

Defined in: packages/forms/src/types.ts:90

Whether the column is NOT NULL (and therefore required in the form).


optional upload: UploadFieldMetadata

Defined in: packages/forms/src/types.ts:104

Upload metadata if the column was decorated with the upload() helper. When present, the form renderer should pick the registered upload component and forward this config through.


validation: ValidationRules

Defined in: packages/forms/src/types.ts:98

Merged validation rules from schema introspection and v annotations.