Object models describe arbitrary data that can be nested inside page models or data models. Usually these models will describe page components such as header, sections, footer, etc. or common components such as buttons.

Object Models share the common model properties.

In addition to common properties, object models also define the following properties:

To reference object models from within other models, use fields of type model.

# stackbit.yaml
...
models:

  # A page model referencing the "action" object model
  page:
    type: page
    ...
    fields:
      ...
      # A "button" field can reference objects represented by the "action" object model
      - type: model
        name: button
        label: Button
        models: [action]

  # The "action" object model
  action:
    type: object
    label: Action 
    labelField: label
	  fields:
      - type: string
        name: label
        label: Label
        required: true
      - type: string
        name: url
        label: URL
        required: true

Example for generic page:

---
title: Home
button:
  label: click me
  url: <https://www.example.com>
---