TermUI.Widget.Label (TermUI v1.0.0)

View Source

A stateless widget for displaying text.

Label is the simplest widget - it renders text with optional styling, alignment, wrapping, and truncation.

This module uses the earlier TermUI.Widget namespace and accepts a props map directly. Call render/2 from the root view; the runtime does not mount it.

Usage

Label.render(%{text: "Hello, World!"}, area)

Label.render(%{
  text: "Centered text",
  align: :center,
  style: %{fg: :blue, bold: true}
}, area)

Props

  • :text - The text to display (required)
  • :align - Text alignment: :left, :center, :right (default: :left)
  • :wrap - Whether to wrap text (default: false)
  • :truncate - Whether to truncate with ellipsis (default: true)
  • :style - Style options (fg, bg, bold, etc.)

Summary

Functions

Returns a description of this component.

Renders the label text within the given area.

Functions

describe()

Returns a description of this component.

render(props, area)

Renders the label text within the given area.