# Relevant Cardscript iconTextBlock

Cardscript

Displays text, allowing control over font sizes, weight, and color.

# Example

{
  "type": "AdaptiveCard",
  "body": [
    {
      "type": "TextBlock",
      "text": "This is a text block"
    }
  ],
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "version": "1.0"
}

# Required properties

# text

Text to display.

  • Type: string

# type

Must be "TextBlock".

  • Type: string
  • Values:
    • TextBlock

# Optional properties

# color

Controls the color of TextBlock elements.

  • Type: string
  • Values:
    • default
    • dark
    • light
    • accent
    • good
    • warning
    • attention

# horizontalAlignment

Controls how elements are horizontally positioned within their container.

  • Type: string
  • Default: "left"
  • Values:
    • left
    • center
    • right

# isSubtle

If true, displays text slightly toned down to appear less prominent.

  • Type: boolean

# maxLines

Specifies the maximum number of lines to display.

  • Type: number

# size

Controls size of text.

  • Type: string
  • Values:
    • small
    • default
    • medium
    • large
    • extraLarge

# weight

Controls the weight of TextBlock elements.

  • Type: string
  • Values:
    • lighter
    • default
    • bolder

# wrap

If true, allow text to wrap. Otherwise, text is clipped.

  • Type: boolean
  • Default: true

# id

A unique identifier associated with the element.

  • Type: string

# spacing

Controls the amount of spacing between this element and the preceding element.

  • Type: string
  • Values:
    • none
    • small
    • default
    • medium
    • large
    • extraLarge
    • padding

# separator

When true, draw a separating line at the top of the element.

  • Type: boolean

# JSON Schema

{
  "additionalProperties": true,
  "type": "TextBlock",
  "description": "Displays text, allowing control over font sizes, weight, and color.",
  "allOf": [
    {
      "$ref": "#/definitions/CardElement"
    }
  ],
  "properties": {
    "color": {
      "type": "string",
      "description": "Controls the color of `TextBlock` elements.",
      "enum": [
        "default",
        "dark",
        "light",
        "accent",
        "good",
        "warning",
        "attention"
      ]
    },
    "horizontalAlignment": {
      "$ref": "#/definitions/HorizontalAlignment"
    },
    "isSubtle": {
      "type": "boolean",
      "description": "If `true`, displays text slightly toned down to appear less prominent.",
      "default": false
    },
    "maxLines": {
      "type": "number",
      "description": "Specifies the maximum number of lines to display."
    },
    "size": {
      "type": "string",
      "description": "Controls size of text.",
      "enum": [
        "small",
        "default",
        "medium",
        "large",
        "extraLarge"
      ]
    },
    "text": {
      "type": "string",
      "description": "Text to display."
    },
    "type": {
      "type": "string",
      "description": "Must be `\"TextBlock\"`.",
      "enum": [
        "TextBlock"
      ]
    },
    "weight": {
      "type": "string",
      "description": "Controls the weight of `TextBlock` elements.",
      "enum": [
        "lighter",
        "default",
        "bolder"
      ]
    },
    "wrap": {
      "type": "boolean",
      "description": "If `true`, allow text to wrap. Otherwise, text is clipped.",
      "default": true
    }
  },
  "required": [
    "type",
    "text"
  ],
  "typeSafe": "text-block",
  "example": "FIXME!",
  "propertySummary": [
    {
      "name": "color",
      "type": "string",
      "required": "Optional",
      "text": "Controls the color of `TextBlock` elements."
    },
    {
      "name": "horizontalAlignment",
      "required": "Optional"
    },
    {
      "name": "isSubtle",
      "type": "boolean",
      "required": "Optional",
      "text": "If `true`, displays text slightly toned down to appear less prominent."
    },
    {
      "name": "maxLines",
      "type": "number",
      "required": "Optional",
      "text": "Specifies the maximum number of lines to display."
    },
    {
      "name": "size",
      "type": "string",
      "required": "Optional",
      "text": "Controls size of text."
    },
    {
      "name": "text",
      "type": "string",
      "required": "Required",
      "text": "Text to display."
    },
    {
      "name": "type",
      "type": "string",
      "required": "Required",
      "text": "Must be `\"TextBlock\"`."
    },
    {
      "name": "weight",
      "type": "string",
      "required": "Optional",
      "text": "Controls the weight of `TextBlock` elements."
    },
    {
      "name": "wrap",
      "type": "boolean",
      "required": "Optional",
      "text": "If `true`, allow text to wrap. Otherwise, text is clipped."
    }
  ]
}
Last Updated: 9/10/2023, 11:30:14 AM