Skip to main content

Text Element API

Text element has all common element properties + some specific properties. Text element also has some unique style properties (check the full table here).

Default middleware

Default middleware for the Text Element will:

  1. Set the content of the text element.
  2. Squeeze it (in case it's too long).

Properties

content Read-Only

  • Type: string

Text content. This is a read-only value, to set the content, use the setContent method.

autoSqueeze

  • Type: boolean

Text will automatically squeeze if its content does not fit in the text element.

autoSize

  • Type: boolean

If the text element should have dynamic size (width and height) based on its content.

multiline

  • Type: boolean

Should text be split into multiple rows if it does not fit in the text element.

Methods

setContent(content)

  • content string

This method sets the content of the text element. It should be used instead of directly modifying the DOM content.

Action example
textElement.setContent("My new content");

squeeze

This method squeezes the text to fit it within the text element.

Action example
textElement.squeeze();