Open Presentation

Search docs

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

    Number Variable

    A number. '{{<id>}}' inserts it as text using 'format'; 'var:<id>' as a whole field supplies the number itself (chart values, font sizes).

    Metadata

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

    Field index

    FieldTypeReq.Description
    typeconstyesVariable kind. One of color, text, number, date, image, url or list.
    type · Allowed values
    "number"
    valuenumber—Number this variable resolves to.
    requiredboolean—Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted.
    labelstring—Optional short human label for forms and fill panels.
    descriptionstring—Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents.
    examplenumber—Illustrative number shown in fill forms and used when a template is previewed with examples. Never written to output.
    formatref:NumberFormat—Display pattern used by '{{<id>}}' (the shared NumberFormat syntax). A literal prefix, a numeric part of '#', '0', ',' and '.', and a literal suffix. '0' pads digits, '#' is optional, ',' groups thousands, digits after '.' fix the decimals ('0' required, '#' optional), and a '%' in the suffix scales by 100. English separators only. Absent: the shortest decimal form.

    type

    typeconstrequiredyesdefault—

    Variable kind. One of color, text, number, date, image, url or list.

    type · Allowed values
    "number"
    type.json
    {
      "type": "number"
    }

    value

    typenumberrequirednodefault—

    Number this variable resolves to.

    required

    typebooleanrequirednodefaulttrue

    Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted.

    label

    typestringrequirednodefault—

    Optional short human label for forms and fill panels.

    description

    typestringrequirednodefault—

    Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents.

    example

    typenumberrequirednodefault—

    Illustrative number shown in fill forms and used when a template is previewed with examples. Never written to output.

    format

    typeref:NumberFormatrequirednodefault—

    Display pattern used by '{{<id>}}' (the shared NumberFormat syntax). A literal prefix, a numeric part of '#', '0', ',' and '.', and a literal suffix. '0' pads digits, '#' is optional, ',' groups thousands, digits after '.' fix the decimals ('0' required, '#' optional), and a '%' in the suffix scales by 100. English separators only. Absent: the shortest decimal form.

    Complete definition constraints
    Schema constraints
    {
      "type": "object",
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "const": "number",
          "description": "Variable kind. One of color, text, number, date, image, url or list."
        },
        "value": {
          "type": "number",
          "description": "Number this variable resolves to."
        },
        "required": {
          "type": "boolean",
          "default": true,
          "description": "Whether the variable must be filled. Defaults to true: a variable with no 'value' is unfilled, and an unfilled required variable is an error in a normal deck and expected in a template. Set false for an optional slot: an unfilled optional variable resolves to empty text (inline tokens) or the field that references it is omitted."
        },
        "label": {
          "type": "string",
          "description": "Optional short human label for forms and fill panels."
        },
        "description": {
          "type": "string",
          "description": "Optional prose describing what the variable is for, surfaced by pickers, fill forms and agents."
        },
        "example": {
          "type": "number",
          "description": "Illustrative number shown in fill forms and used when a template is previewed with examples. Never written to output."
        },
        "format": {
          "$ref": "#/$defs/NumberFormat",
          "description": "Display pattern used by '{{<id>}}' (the shared NumberFormat syntax). A literal prefix, a numeric part of '#', '0', ',' and '.', and a literal suffix. '0' pads digits, '#' is optional, ',' groups thousands, digits after '.' fix the decimals ('0' required, '#' optional), and a '%' in the suffix scales by 100. English separators only. Absent: the shortest decimal form."
        }
      },
      "description": "A number. '{{<id>}}' inserts it as text using 'format'; 'var:<id>' as a whole field supplies the number itself (chart values, font sizes)."
    }