Tinacms Developer Docs
Fields

Object Field

A nested field for grouping related data or creating block-based content

A nested field that groups related data together. Can be used for single objects, lists, or block-based page builders with templates.

Usage

{
  type: 'object',
  name: 'author',
  label: 'Author',
  fields: [
    { type: 'string', name: 'name', label: 'Name' },
    { type: 'string', name: 'bio', label: 'Bio' },
  ],
}

Options

PropertyTypeDescription
type'object'Required.
namestringField identifier.
labelstringDisplay label in the editor.
fieldsField[]Nested fields. Use this OR templates.
templatesTemplate[]Block templates for page builders. Use this OR fields.
listbooleanAllow multiple items.
ui.visualSelectorbooleanShow visual block picker for templates.
ui.itemProps(item) => { label }Custom labels for list items.
ui.defaultItemobjectDefault values for new items.

Type Signature

interface ObjectField {
  type: 'object'
  name: string
  label?: string
  list?: boolean
  fields?: Field[]
  templates?: Template[]
  ui?: {
    visualSelector?: boolean
    itemProps?: (item: Record<string, unknown>) => { label?: string }
    defaultItem?: Record<string, unknown>
  }
}

Examples

List of Objects

{
  type: 'object',
  name: 'testimonials',
  label: 'Testimonials',
  list: true,
  fields: [
    { type: 'string', name: 'author', label: 'Author' },
    { type: 'string', name: 'quote', label: 'Quote', ui: { component: 'textarea' } },
  ],
}

Page Blocks (Templates)

Allow editors to build pages from predefined block types:

{
  type: 'object',
  name: 'blocks',
  label: 'Page Blocks',
  list: true,
  templates: [
    {
      name: 'hero',
      label: 'Hero',
      fields: [
        { type: 'string', name: 'heading' },
        { type: 'image', name: 'image' },
      ],
    },
    {
      name: 'features',
      label: 'Features',
      fields: [
        { type: 'object', name: 'items', list: true, fields: [/* ... */] },
      ],
    },
  ],
}

With Visual Selector

Add preview images to the block picker:

{
  type: 'object',
  name: 'blocks',
  label: 'Page Blocks',
  list: true,
  ui: { visualSelector: true },
  templates: [
    {
      name: 'hero',
      label: 'Hero',
      ui: { previewSrc: '/img/blocks/hero.png' },
      fields: [/* ... */],
    },
  ],
}

On this page