Skip to content

Label

extends Element

Label: text display. Auto-sizes to its text until width is set manually; with a manual width the text word-wraps and the height auto-grows until height is set manually too.

Properties

PropertyTypeDefaultDescription
textany""Displayed text; numbers and dynamic values are tostring-ed
widthnumber1Setting a width manually disables auto-sizing and enables word wrap
heightnumber1Grows with the wrapped text until set manually

Methods

Label:setup()

Initializes per-instance state and input handlers.

Label:render(buf)

Renders the label (single line, or word-wrapped with a manual width).

  • buf (Render) The render buffer

Label:measure()

Intrinsic size for basalt.auto(): text length x 1.

  • returns width (number) The measured width
  • returns height (number) The measured height

Last updated:

Released under the MIT License.