Open Presentation

Search docs

Loading documentation…
    OpenPresentation/opf
    Browse docs
    On this page
    View source

    Caption

    A caption for an image, chart, table, video, embed or diagram payload. A string or TextRun[] is the caption text placed below the media; object form adds the position and alignment.

    Metadata

    Definition
    #/$defs/Caption
    Form
    3 alternative forms (oneOf)
    Source
    spec/schemas/opf.schema.json

    Field index

    This definition uses the forms or value constraints below.

    oneOf 1 · string

    Exact constraints for oneOf 1
    oneOf 1 schema
    {
      "type": "string"
    }

    oneOf 2 · array<ref:TextRun>

    Exact constraints for oneOf 2
    oneOf 2 schema
    {
      "type": "array",
      "items": {
        "$ref": "#/$defs/TextRun"
      }
    }

    oneOf 3 · object

    FieldTypeReq.DefaultDescription
    textstring | array<ref:TextRun>yes—Caption text: a string or TextRun[] for inline rich text.
    positionenum——Where the caption band sits inside the block's region: below the media (default) or above it. Core composition reserves the band and shrinks the media by its height.
    position · Allowed values
    "below""above"
    alignenum——Horizontal alignment of the caption text within the block. Defaults to start. Logical: 'start' is the edge a paragraph starts on (the left for left-to-right text, the right for right-to-left text) and 'end' is the opposite edge.
    align · Allowed values
    "start""center""end"

    text

    typestring | array<ref:TextRun>requiredyesdefault—

    Caption text: a string or TextRun[] for inline rich text.

    text (oneOf 2)[] (oneOf 2).color (anyOf 2).color · Named choices (see schema for other values and constraints)
    "accent1""accent2""accent3""accent4""accent5""accent6""dark1""dark2""light1""light2""hyperlink""followedHyperlink""primary""secondary""accent""background""surface""surfaceAlt""text""textSecondary"

    position

    typeenumrequirednodefault—

    Where the caption band sits inside the block's region: below the media (default) or above it. Core composition reserves the band and shrinks the media by its height.

    position · Allowed values
    "below""above"
    position.json
    {
      "position": "below"
    }

    align

    typeenumrequirednodefault—

    Horizontal alignment of the caption text within the block. Defaults to start. Logical: 'start' is the edge a paragraph starts on (the left for left-to-right text, the right for right-to-left text) and 'end' is the opposite edge.

    align · Allowed values
    "start""center""end"
    align.json
    {
      "align": "start"
    }
    Exact constraints for oneOf 3
    oneOf 3 schema
    {
      "type": "object",
      "required": [
        "text"
      ],
      "additionalProperties": false,
      "properties": {
        "text": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/TextRun"
              }
            }
          ],
          "description": "Caption text: a string or TextRun[] for inline rich text."
        },
        "position": {
          "type": "string",
          "enum": [
            "below",
            "above"
          ],
          "description": "Where the caption band sits inside the block's region: below the media (default) or above it. Core composition reserves the band and shrinks the media by its height."
        },
        "align": {
          "type": "string",
          "enum": [
            "start",
            "center",
            "end"
          ],
          "description": "Horizontal alignment of the caption text within the block. Defaults to start. Logical: 'start' is the edge a paragraph starts on (the left for left-to-right text, the right for right-to-left text) and 'end' is the opposite edge."
        }
      }
    }
    Complete definition constraints
    Schema constraints
    {
      "description": "A caption for an image, chart, table, video, embed or diagram payload. A string or TextRun[] is the caption text placed below the media; object form adds the position and alignment.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TextRun"
          }
        },
        {
          "type": "object",
          "required": [
            "text"
          ],
          "additionalProperties": false,
          "properties": {
            "text": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/TextRun"
                  }
                }
              ],
              "description": "Caption text: a string or TextRun[] for inline rich text."
            },
            "position": {
              "type": "string",
              "enum": [
                "below",
                "above"
              ],
              "description": "Where the caption band sits inside the block's region: below the media (default) or above it. Core composition reserves the band and shrinks the media by its height."
            },
            "align": {
              "type": "string",
              "enum": [
                "start",
                "center",
                "end"
              ],
              "description": "Horizontal alignment of the caption text within the block. Defaults to start. Logical: 'start' is the edge a paragraph starts on (the left for left-to-right text, the right for right-to-left text) and 'end' is the opposite edge."
            }
          }
        }
      ],
      "examples": [
        "Figure 1. Quarterly revenue by region",
        {
          "text": "Source: internal reporting",
          "position": "above",
          "align": "center"
        }
      ]
    }