OPF

Search docs

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

    Metric

    Metric content with optional display metadata. Use 'value' for the primary value, 'label' for the metric name, 'description' for supporting context, 'unit' for a suffix/currency marker, 'delta' for change, 'trend' for direction, and 'sentiment' for whether the change is good news. A string or number value in a metric field is shorthand for { "value": value }; numeric values remain numbers and are formatted by renderers.

    Metadata

    Definition
    #/$defs/Metric
    Form
    object
    Source
    spec/schemas/opf.schema.json

    Field index

    FieldTypeReq.Description
    valuestring | numberyesPrimary metric value.
    labelstring—Metric label.
    descriptionstring—Optional supporting context for the metric.
    unitstring—Metric unit, suffix, or currency marker.
    deltastring | number—Metric change value.
    trendenum—Metric trend direction. The preview and the PowerPoint export draw it as an arrow that always points the way the trend does (up, down or flat), before the delta on its line (or before the label without a delta), and color the arrow and the delta text by sentiment. The word itself is not drawn; it is the arrow's text alternative.
    trend · Allowed values
    "up""down""flat"
    sentimentenum—Whether the change is good news. Positive draws the trend arrow and the trend and delta text in green, negative in red and neutral in the neutral text colour, each kept at 4.5:1 contrast or more against the slide background. When absent the colour follows the trend: up is positive, down is negative and flat is neutral. Set it when the direction is not the verdict, for example positive on a falling churn, cost or latency trend. The arrow always keeps the direction of trend. Only the trend arrow and the trend and delta text take the colour, so sentiment has no visible effect on a metric without a trend.
    sentiment · Allowed values
    "positive""negative""neutral"
    iconref:IconReference—An icon drawn on a chip above the metric: "<set>:<name>" ("lucide:users"), a name from the deck's icons, or an SVG source. Decoration only: when the slide has no room for it without setting text smaller, it is not drawn (finding opf/icon-dropped). See docs/icons.md.

    value

    typestring | numberrequiredyesdefault—

    Primary metric value.

    value.json
    {
      "value": 42
    }

    label

    typestringrequirednodefault—

    Metric label.

    label.json
    {
      "label": "Revenue"
    }

    description

    typestringrequirednodefault—

    Optional supporting context for the metric.

    description.json
    {
      "description": "Recognized revenue for the quarter."
    }

    unit

    typestringrequirednodefault—

    Metric unit, suffix, or currency marker.

    unit.json
    {
      "unit": "%"
    }

    delta

    typestring | numberrequirednodefault—

    Metric change value.

    delta.json
    {
      "delta": "+12%"
    }

    trend

    typeenumrequirednodefault—

    Metric trend direction. The preview and the PowerPoint export draw it as an arrow that always points the way the trend does (up, down or flat), before the delta on its line (or before the label without a delta), and color the arrow and the delta text by sentiment. The word itself is not drawn; it is the arrow's text alternative.

    trend · Allowed values
    "up""down""flat"
    trend.json
    {
      "trend": "up"
    }

    sentiment

    typeenumrequirednodefault—

    Whether the change is good news. Positive draws the trend arrow and the trend and delta text in green, negative in red and neutral in the neutral text colour, each kept at 4.5:1 contrast or more against the slide background. When absent the colour follows the trend: up is positive, down is negative and flat is neutral. Set it when the direction is not the verdict, for example positive on a falling churn, cost or latency trend. The arrow always keeps the direction of trend. Only the trend arrow and the trend and delta text take the colour, so sentiment has no visible effect on a metric without a trend.

    sentiment · Allowed values
    "positive""negative""neutral"
    sentiment.json
    {
      "sentiment": "positive"
    }

    icon

    typeref:IconReferencerequirednodefault—

    An icon drawn on a chip above the metric: "<set>:<name>" ("lucide:users"), a name from the deck's icons, or an SVG source. Decoration only: when the slide has no room for it without setting text smaller, it is not drawn (finding opf/icon-dropped). See docs/icons.md.

    Complete definition constraints
    Schema constraints
    {
      "type": "object",
      "description": "Metric content with optional display metadata. Use 'value' for the primary value, 'label' for the metric name, 'description' for supporting context, 'unit' for a suffix/currency marker, 'delta' for change, 'trend' for direction, and 'sentiment' for whether the change is good news. A string or number value in a metric field is shorthand for { \"value\": value }; numeric values remain numbers and are formatted by renderers.",
      "additionalProperties": false,
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ],
          "description": "Primary metric value.",
          "examples": [
            42,
            "$12.4M",
            "98%"
          ]
        },
        "label": {
          "type": "string",
          "description": "Metric label.",
          "examples": [
            "Revenue",
            "Retention",
            "Latency"
          ]
        },
        "description": {
          "type": "string",
          "description": "Optional supporting context for the metric.",
          "examples": [
            "Recognized revenue for the quarter.",
            "Median API latency across production traffic."
          ]
        },
        "unit": {
          "type": "string",
          "description": "Metric unit, suffix, or currency marker.",
          "examples": [
            "%",
            "ms",
            "$M"
          ]
        },
        "delta": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            }
          ],
          "description": "Metric change value.",
          "examples": [
            "+12%",
            -4.2
          ]
        },
        "trend": {
          "type": "string",
          "enum": [
            "up",
            "down",
            "flat"
          ],
          "description": "Metric trend direction. The preview and the PowerPoint export draw it as an arrow that always points the way the trend does (up, down or flat), before the delta on its line (or before the label without a delta), and color the arrow and the delta text by `sentiment`. The word itself is not drawn; it is the arrow's text alternative."
        },
        "sentiment": {
          "type": "string",
          "enum": [
            "positive",
            "negative",
            "neutral"
          ],
          "description": "Whether the change is good news. Positive draws the trend arrow and the trend and delta text in green, negative in red and neutral in the neutral text colour, each kept at 4.5:1 contrast or more against the slide background. When absent the colour follows the trend: up is positive, down is negative and flat is neutral. Set it when the direction is not the verdict, for example positive on a falling churn, cost or latency trend. The arrow always keeps the direction of `trend`. Only the trend arrow and the trend and delta text take the colour, so sentiment has no visible effect on a metric without a trend."
        },
        "icon": {
          "$ref": "#/$defs/IconReference",
          "description": "An icon drawn on a chip above the metric: \"<set>:<name>\" (\"lucide:users\"), a name from the deck's icons, or an SVG source. Decoration only: when the slide has no room for it without setting text smaller, it is not drawn (finding opf/icon-dropped). See docs/icons.md."
        }
      }
    }