Dyrected
Model ContentFields

Object

A nested object that groups related fields under a single key.

The object field nests a set of fields under a single key, storing them as an embedded object on the document. Use it to keep related fields together — an address, an SEO block, or a set of dimensions — without creating a separate collection. The helper is defineObjectField.

defineObjectField({
  name: 'seo',
  label: 'SEO',
  fields: [
    defineTextField({ name: 'title', label: 'Meta title' }),
    defineTextareaField({ name: 'description', label: 'Meta description' }),
  ],
})

The fields are stored under the object field's name, so the example above saves as { seo: { title, description } }. The nested fields behave like any others — they validate, hook, and render the same way — they just live one level down. An object field shares its parent document's lifecycle: it is created, updated, and deleted with the document, never on its own. When the same shape instead repeats, use an Array; when the content should be its own record with its own lifecycle, give it a Collection and point at it with a Relationship.

Choosing the summary field in the admin

Object fields also need a readable summary in compact admin surfaces such as collection list cells. Set admin.useAsTitle on the object field when one child field should clearly represent the whole object.

defineObjectField({
  name: "seo",
  label: "SEO",
  admin: {
    useAsTitle: "title",
  },
  fields: [
    defineTextField({ name: "title", label: "Meta title" }),
    defineTextareaField({ name: "description", label: "Meta description" }),
  ],
})

If you leave it unset, Dyrected falls back to common child field names such as title, name, and label, then to the first usable child field. Like collection-level admin.useAsTitle, this child field reference is type-checked while you author config.

Generated reference

The contract below is generated from the public @dyrected/core exports by @dyrected/knowledge, so it stays in sync with the package. See Fields for the shared field options every type accepts.

ObjectField

A group of nested fields stored as an embedded object under this field's name.

export type ObjectField = TypedField<"object", unknown>;

On this page

Dyrected| Cloud

Get your backend ready in minutes

Use a managed database, storage, APIs, and admin dashboard without setting up the infrastructure yourself.

Set Up My Backend