text
text<
TFieldMeta>(options?):TextField<TFieldMeta>
Defined in: packages/core/src/fields/text/config.ts:49
Creates a text field with all defaults applied.
Text fields store short, single-line string values. Common uses: titles, names, slugs, URLs, email addresses.
Accepts TextFieldInput (all optional) and returns TextField with all defaults applied.
Defaults applied:
label—""(inferred from the field key bydefineCollection)required—falseadmin.hidden—falseadmin.readOnly—falseadmin.position—"main"admin.width—"full"admin.cellAlignment—"left"
Type Parameters
Section titled “Type Parameters”TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends BaseFieldMeta = BaseFieldMeta
Parameters
Section titled “Parameters”options?
Section titled “options?”TextFieldInput<TFieldMeta>
Text field configuration. All properties are optional.
Returns
Section titled “Returns”TextField<TFieldMeta>
Resolved text field definition with all defaults applied.
Example
Section titled “Example”import { text, defineCollection } from '@vexcms/core'
posts: defineCollection({ fields: { // Minimal — label inferred from key ("Title") title: text(),
// Required slug with length validation and a database index slug: text({ required: true, min: { value: 3 }, max: { value: 100 }, index: "by_slug" }),
// Author name with a placeholder hint in the admin form authorName: text({ required: true, admin: { width: "half", placeholder: "e.g. Jane Smith" }, }), }})- TextFieldInput for the full input type
- TextField for the resolved output type