type

Config

Choose a rich-text field's editing tools, allowed collections, blocks, and admin presentation.

Example

go
richtext.Field("content", richtext.Config{
  UploadCollections: []string{"media"},
  Admin: richtext.Admin{FixedToolbar: true},
}).Required()

Properties

PropertyTypeDescription
Blocks[]field.BlockBlock definitions owned by this field. Enables the block tools.
BlockReferences[]stringSlugs of blocks registered in the root Config.Blocks. Use this or Blocks, not both.
Features[]FeatureOptional editing tools. Nil keeps the defaults; an empty slice disables every optional tool.
UploadCollections[]stringUpload collections the media picker and validation allow. Empty allows every compatible collection.
RelationshipCollections[]stringCollections the relationship picker and validation allow. Empty allows every compatible collection.
AdminAdminToolbar and layout options for the admin editor. The zero value keeps every default.

How it works

A nil Features slice inherits defaults; an explicit empty slice disables every optional feature. Empty collection allowlists permit every compatible collection, while non-empty lists restrict node targets.

Full signature

type Config struct { // Blocks is the fixed executable schema allowlist. Fields are resolved // through the public embedded-fields contract, never serialized as settings. Blocks []field.Block `json:"-"` // BlockReferences selects Config.Blocks definitions; it is exclusive with Blocks. BlockReferences []string `json:"-"` Features []Feature `json:"features"` UploadCollections []string `json:"uploadCollections,omitempty"` RelationshipCollections []string `json:"relationshipCollections,omitempty"` // Admin changes how the editor looks and behaves in the admin. It never // changes what a document can store. Admin Admin `json:"admin,omitzero"` }

Source plugins/richtext/richtext.go:37

Related guides