Skip to content

Text Box

Simon Tharby edited this page Sep 27, 2020 · 3 revisions

text_box

Multiple paragraphs can be specified.
"<br />" = blank line.
Each paragraph will be allocated an id, enabling update or styling of text for specific paragraph(s).
centered will default to false if not included in args.

Format:

addText(name, parent, [para1, ...], centered)

Example usage (see uiLayout.js for more examples):

let parent = document.getElementById("ui-container");

uiElements.addText(
      "example_text_box",
      parent,
      ["This is a text box.",
        "<br />",
        "It will grow to fit the text provided."]
    );

Example of generated HTML:

<div id="example_text_box" class="text-box">
  <p id="example_text_box_0">This is a text box.</p>
  <p id="example_text_box_1"><br></p>
  <p id="example_text_box_2">It will grow to fit the text provided.</p>
</div>
Clone this wiki locally