Skip to content

richtext

richtext<TCollectionSlug, TFieldKey, TFieldMeta>(options?): RichTextField<TCollectionSlug, TFieldMeta>

Defined in: packages/core/src/fields/richtext/config.ts:50

Creates a richtext field with all defaults applied.

Richtext fields store a single locale-agnostic rich-text document — body copy, article content, anything requiring headings, marks, and inline media rather than a plain string. Editing requires a configured editor adapter on VexClientConfig (e.g. editor: plateEditor()); the admin Input renders a configuration error, not markup, when it is absent.

Accepts RichTextFieldInput (all optional) and returns RichTextField with all defaults applied.

Defaults applied:

  • label — "" (inferred from the field key by defineCollection)
  • required — false
  • defaultValue — []
  • admin.hidden — false
  • admin.readOnly — false
  • admin.position — "main"
  • admin.width — "100%"
  • admin.cellAlignment — "left"

TCollectionSlug extends string = string

TFieldKey extends string = never

TFieldMeta extends BaseFieldMeta = BaseFieldMeta

RichTextFieldInput<TCollectionSlug, TFieldKey, TFieldMeta>

Richtext field configuration. All properties are optional.

RichTextField<TCollectionSlug, TFieldMeta>

Resolved richtext field definition with all defaults applied.

import { richtext, defineCollection } from '@vexcms/core'
posts: defineCollection({
fields: {
// Minimal — label inferred from key ("Body")
body: richtext(),
// Required field, e.g. an article summary
excerpt: richtext({ required: true }),
}
})