Formatted String

Using a formatted string requires loading formatted-string and span module.

import { FormattedString } from "tns-core-modules/text/formatted-string";
import { Span } from "tns-core-modules/text/span";

How to set formatted text content for a label

const label = new Label();
const formattedString = new FormattedString();
const firstSpan = new Span();

firstSpan.fontSize = 15;
firstSpan.text = "LoremIpsum";
formattedString.spans.push(firstSpan);
label.formattedText = formattedString;

Stay connected with NativeScript

(expect a newsletter every 4-8 weeks)

NativeScript
NativeScript is licensed under the Apache 2.0 license .
© Progress Software Corporation. All Rights Reserved.