TextFieldInput
Defined in: packages/core/src/fields/text/types.ts:47
Configuration input for a text() field.
Text fields store short, single-line string values — titles, slugs, URLs, email addresses, status labels, etc. All properties are optional; unset properties fall back to the defaults listed below.
Defaults applied by text():
{ type: "text", label: "", // inferred from the field key by defineCollection required: false, // field is optional by default 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", // text aligned left in the data table column }}Example
Section titled “Example”// Minimal — label is inferred from the key ("Title")title: text()
// Required slug with length validation and a database indexslug: text({ required: true, min: { value: 3 }, max: { value: 100 }, index: "by_slug" })
// Author name with a placeholder hint shown in the admin formauthorName: text({ required: true, admin: { width: "half", placeholder: "e.g. Jane Smith" }})
// Pre-filled default for a URL fieldcanonicalUrl: text({ defaultValue: "https://example.com" })BaseFieldInput for shared properties (label, description, required, admin, index, searchIndex)
Extends
Section titled “Extends”BaseFieldInput<TFieldMeta>
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput
Defined in: packages/core/src/fields/baseTypes.ts:209
Admin UI configuration for this field.
Inherited from
Section titled “Inherited from”defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:string
Defined in: packages/core/src/fields/text/types.ts:55
Pre-filled value shown in the admin form when creating a new field. Does not apply to database values
Overrides
Section titled “Overrides”description?
Section titled “description?”
optionaldescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:194
Semantic description of the field. Used in three places:
- Helper text rendered below the field input in the admin form UI.
- As the Zod
.meta({ description })value for form validation. - As the JSDoc comment on the generated document interface property.
To write a separate JSDoc comment, use interfaceDescription in addition.
Inherited from
Section titled “Inherited from”index?
Section titled “index?”
optionalindex?: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.
Example
Section titled “Example”slug: { type: "text", index: "by_slug", required: true }// Generates: .index("by_slug", ["slug"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:196
The JSDoc comment on the generated document interface property
Inherited from
Section titled “Inherited from”BaseFieldInput.interfaceDescription
label?
Section titled “label?”
optionallabel?:string
Defined in: packages/core/src/fields/baseTypes.ts:185
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”
optionalmax?:object
Defined in: packages/core/src/fields/text/types.ts:64
Maximum character length config.
error?
Section titled “error?”
optionalerror?:string
Maximum character length error message.
value:
number
Maximum character length value.
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:221
Inherited from
Section titled “Inherited from”
optionalmin?:object
Defined in: packages/core/src/fields/text/types.ts:57
Minimum character length config.
error?
Section titled “error?”
optionalerror?:string
Minimum character length error message.
value:
number
Minimum character length value.
required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:202
Whether this field is required.
Default: false
Inherited from
Section titled “Inherited from”searchIndex?
Section titled “searchIndex?”
optionalsearchIndex?:object
Defined in: packages/core/src/fields/text/types.ts:83
Create a full-text search index on this field.
The field this is defined on becomes the searchField.
filterFields
Section titled “filterFields”filterFields:
string[]
Fields to filter search results by. String array — validated at runtime against collection field names.
name:
string
Search index name (must be unique within the collection).
Example
Section titled “Example”title: { type: "text", searchIndex: { name: "search_title", filterFields: ["status", "author"] },}// Generates: .searchIndex("search_title", { searchField: "title", filterFields: ["status", "author"] })