TextBlock

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

Interface

interface ITextBlock extends IElement {
  text: string | ILocales;
  applyMarkdown?: boolean;
  weight?: TextWeight;
  size?: TextSize;
  wrap?: boolean;
  maxLines?: number;
  title?: string;
  highlightedText?: string;
}

Example

TextBlock
{
  "type": "TextBlock",
  "size": "small",
  "text": "{base.author.name}",
  "onClick": {
    "type": "OpenUrl",
    "url": "@eval({base.author.pageDetailUrl}+'&'+{base.author.name})"
  },
  "style": {
    "color": "#999999"
  }
}

Properties

type

Must be “TextBlock”.

  • Type: "TextBlock"

  • Required: Yes

text

Text to display.

applyMarkdown

Allows markdown formatting to be used in the text property.

  • Type: boolean

  • Required: No

  • Default value: false

weight

Controls text weight.

size

Controls text size

wrap

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

  • Type: boolean

  • Required: No

  • Default value: false

maxLines

Specifies the maximum number of lines to display.

  • Type: number

  • Required: No

title

Specifies extra information about an element.

  • Type: string

  • Required: No

highlightedText

Specifies the word or sentence to be highlighted from the text.

  • Type: string

  • Required: No