Skip to main content

TextContent

Describes all information needed to display text.

TYPE
object

Properties

NAMETYPEDESCRIPTION
richTextRichTextThe text formatted as a set of nodes. Used when the "RICH" type is set
plainTextstringThe text without any formatting. Used when the "PLAIN" type is set.
type"PLAIN" | "RICH"Does this text support rich text formatting like headings. If "PLAIN" a faster text rendering path will be used.
styleTextStyleThe style of the text
widthTextSizeThe width of this text content
heightTextSizeThe height of this text content

Type Definitions

RichText

An array of text descendents.

Examples

A single paragraph with the text Owlbear Rodeo

[
{
"type": "paragraph",
"children": [{ "text": "Owlbear Rodeo" }]
}
]

A heading, subhead and paragraph.

[
{
"type": "heading-one",
"children": [
{
"text": "Heading"
}
]
},
{
"type": "heading-two",
"children": [
{
"text": "Subhead"
}
]
},
{
"type": "paragraph",
"children": [
{
"text": "Paragraph"
}
]
}
]

A paragraph with regular, bold and italics.

{
"type": "paragraph",
"children": [
{
"text": "Regular "
},
{
"text": "Bold",
"bold": true
},
{
"text": " "
},
{
"text": "Italics",
"italic": true
}
]
}

A bulleted list with a bold item.

[
{
"type": "bulleted-list",
"children": [
{
"type": "list-item",
"children": [
{
"text": "List 1"
}
]
},
{
"type": "list-item",
"children": [
{
"text": "List 2",
"bold": true
}
]
},
{
"type": "list-item",
"children": [
{
"text": "List 3"
}
]
}
]
}
]
TYPE
Descendent[]

Descendent

An array of elements or text blocks.

TYPE
(Element | Text)[]

Element

TYPE
BulletedListElement | NumberedListElement | HeadingOneElement | HeadingTwoElement | ListItemElement | ParagraphElement

Text

TYPE
object

Properties

NAMETYPEDESCRIPTION
textstringThe text to display
italicbooleanAn optional boolean to enable italics for this text
boldbooleanAn optional boolean to enable bold for this text

TextStyle

TYPE
object

Properties

NAMETYPEDESCRIPTION
fillColorstringThe fill color of the text
fillOpacitynumberThe fill opacity of the text between 0 and 1
strokeColorstringThe stroke color of the text
strokeOpacitynumberThe stroke opacity of the text between 0 and 1
strokeWidthnumberThe stroke width of the text in pixels
textAlign"LEFT" | "CENTER" | "RIGHT"The horizontal alignment of the text
textAlignVertical"BOTTOM" | "MIDDLE" | "TOP"The vertical alignment of the text
fontFamilystringThe font for the text
fontSizenumberThe size of the text in pixels
fontWeightnumberThe weight of the text
lineHeightnumberThe line height of the text relative to the font size
paddingnumberThe padding for the text in pixels

TextSize

The size of a text block either in pixels or the string "AUTO" for automatic sizing based on the content.

TYPE
number | "AUTO"

Text Elements

BulletedListElement

Equivalent to the <ul> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"bulleted-list"The type of this element
childrenDescendent[]The children for this element

NumberedListElement

Equivalent to the <ol> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"numbered-list"The type of this element
childrenDescendent[]The children for this element

HeadingOneElement

Equivalent to the <h1> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"heading-one"The type of this element
childrenDescendent[]The children for this element

HeadingTwoElement

Equivalent to the <h2> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"heading-two"The type of this element
childrenDescendent[]The children for this element

ListItemElement

Equivalent to the <li> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"list-item"The type of this element
childrenDescendent[]The children for this element

ParagraphElement

Equivalent to the <p> HTML element.

TYPE
object

Properties

NAMETYPEDESCRIPTION
type"paragraph"The type of this element
childrenDescendent[]The children for this element