Text

Register on Lenra

Element of type Text

text

This is a typical text component.

This component has a children property in case some complex text needs to be done (see examples below).

Examples

Basic text

{
    "type": "text",
    "value": "This is a text.",
}

Complex text

This is an example involving a complex text. It is composed of bold and italic values all in one sentence.

{
    "type": "text",
    "value": "This is a text involving",
    "children": [
        {
            "type": "text",
            "value": "bold",
            "style": {
              "fontWeight": "bold",
            },
        },
        {
            "type": "text",
            "value": "and",
        },
        {
            "type": "text",
            "value": "italic",
            "style": {
              "fontStyle": "italic",
            },
        },
        {
            "type": "text",
            "value": "values.",
        },
    ]
}

Properties

AttributeDescriptionTypeDetails
typeThe type of the elementstring ("text")
valuethe value displayed in the elementstring
childrenAdditional texts to add after this text.component[]typestring ("text")
localeElement of type localeLocale
semanticsLabelThe value to explain a different semanticsstring
spellOutWhether the assistive technologies should spell out this text character by characterboolean
styleThe style of the Text.TextStyle
textAlignThe text alignmentstring ("left", "center", "right", "justify", "start", "end")