RichTextFieldInput
Defined in: packages/core/src/fields/richtext/types.ts:82
Configuration input for a richtext() field.
Richtext fields store a single locale-agnostic RichTextDocument — an
array of block-level nodes. Shape is validated structurally on save (array of
{ type, children } elements and { text } leaves, any depth); the specific
node catalogue (headings, links, images, tables, …) is owned by whichever
editor adapter is configured on VexClientConfig, never by core.
Defaults applied by richtext():
{ type: "richtext", label: "", // inferred from the field key by defineCollection required: false, // field is optional by default defaultValue: [], // empty document 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: "100%", // spans the full form width, not half cellAlignment: "left", // excerpt aligned left in the data table column }}Example
Section titled “Example”// Minimal — label inferred from the key ("Body")body: richtext()
// Required — at least one node's plain-text excerpt must be non-emptysummary: richtext({ required: true })BaseFieldInput for shared properties (label, description, required, admin, index, searchIndex)
Extends
Section titled “Extends”BaseFieldInput<TCollectionSlug,TFieldKey,TFieldMeta>
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends VexResourceSlug = VexResourceSlug
TFieldKey
Section titled “TFieldKey”TFieldKey extends string = never
TFieldMeta
Section titled “TFieldMeta”TFieldMeta extends object = { }
Properties
Section titled “Properties”admin?
Section titled “admin?”
optionaladmin?:FieldAdminConfigInput<TCollectionSlug,ComponentHKT>
Defined in: packages/core/src/fields/baseTypes.ts:531
Admin UI configuration for this field.
Inherited from
Section titled “Inherited from”defaultValue?
Section titled “defaultValue?”
optionaldefaultValue?:RichTextDocument
Defined in: packages/core/src/fields/richtext/types.ts:108
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:516
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?: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.
Example
Section titled “Example”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"])Inherited from
Section titled “Inherited from”interfaceDescription?
Section titled “interfaceDescription?”
optionalinterfaceDescription?:string
Defined in: packages/core/src/fields/baseTypes.ts:518
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:507
Display label for the field in the admin form.
Inherited from
Section titled “Inherited from”mediaCollectionSlug?
Section titled “mediaCollectionSlug?”
optionalmediaCollectionSlug?:string
Defined in: packages/core/src/fields/richtext/types.ts:107
The slug of the media collection inline images upload into. Absent means the richtext editor’s image feature is hidden entirely — no dropzone, no paste/drag-and-drop upload, no “insert image” toolbar button — rather than rendering a feature that would immediately fail every upload.
Must match a media collection declared on defineConfig({ mediaCollections }),
exactly like upload()’s to; an unknown slug throws VexStorageConfigError
at defineConfig() time. Unlike to, it is optional — a richtext field
without inline images is a normal, supported field.
Example
Section titled “Example”richtext({ label: "Body", mediaCollectionSlug: "images" })
optionalmeta?:TFieldMeta
Defined in: packages/core/src/fields/baseTypes.ts:546
Inherited from
Section titled “Inherited from”required?
Section titled “required?”
optionalrequired?:boolean
Defined in: packages/core/src/fields/baseTypes.ts:524
Whether this field is required.
Default: false
Inherited from
Section titled “Inherited from”Methods
Section titled “Methods”validate()?
Section titled “validate()?”
optionalvalidate(props):void|Promise<void>
Defined in: packages/core/src/fields/richtext/types.ts:110
Server-only async validation with value typed as RichTextDocument.
Parameters
Section titled “Parameters”FieldValidateProps<TCollectionSlug, RichTextDocument>
Returns
Section titled “Returns”void | Promise<void>
Overrides
Section titled “Overrides”BaseFieldInput.validate