Generate experiences with Puck AI
Read docs
API ReferenceFieldsObject

Object

Render an object with a subset of fields. Extends Base.

const config = {
  components: {
    Example: {
      fields: {
        params: {
          type: "object",
          objectFields: {
            title: { type: "text" },
          },
        },
      },
      render: ({ params }) => {
        return <p>{params.title}</p>;
      },
    },
  },
};

Params

ParamExampleTypeStatus
typetype: "object"”object”Required
objectFieldsobjectFields: { title: { type: "text" } }ObjectRequired
collapsiblecollapsible: trueBoolean-
defaultExpandeddefaultExpanded: trueBoolean-
variantvariant: "flush""card" | "flush"-

Required params

type

The type of the field. Must be "object" for Object fields.

const config = {
  components: {
    Example: {
      fields: {
        items: {
          type: "object",
          objectFields: {
            title: { type: "text" },
          },
        },
      },
      // ...
    },
  },
};

objectFields

Describe the fields for the object. Shares an API with fields.

Can include any field type, including nested object fields.

const config = {
  components: {
    Example: {
      fields: {
        items: {
          type: "object",
          objectFields: {
            title: { type: "text" },
          },
        },
      },
      // ...
    },
  },
};

Optional params

collapsible

Let users expand and collapse the subfields. Defaults to false.

If using <AutoField>, you need to pass a label to show the toggle.

defaultExpanded

Expand the subfields by default. Only applies when collapsible is true. Defaults to false.

variant

The visual style of the subfields. Defaults to "card".

  • "card" (default): render the subfields inside a bordered container.
  • "flush": render the subfields without a container. Nested object fields or groups are indented.