text (cellium v0.1.0)

View Source

Text widget module for displaying static text.

This module provides a simple text widget that can display static text with optional word wrapping.

Usage

Basic text widget:

text:new(my_text, "Hello, World!")

Text widget with wrapping (requires expand or size to get width from layout):

Widget = text:new(my_text, "This is a long text that will wrap"),
WrappingWidget = Widget#{wrap => true, expand => true}

Properties

  • wrap (boolean): Enable word wrapping. When true, text wraps at the widget's width (set by the layout system). Default: false
  • expand (boolean): Request the layout system to assign width and height. Required when using wrap. Default: false
  • width (integer): Set by the layout system when expand is true

Summary

Functions

Creates a new text widget with empty content.

Creates a new text widget with the specified content.

Renders the text widget to the buffer.

Functions

new(Id)

-spec new(term()) -> map().

Creates a new text widget with empty content.

new(Id, Content)

-spec new(term(), string()) -> map().

Creates a new text widget with the specified content.

render(Widget, Buffer)

-spec render(map(), map()) -> map().

Renders the text widget to the buffer.

If wrap is enabled and width is set by layout, text wraps at word boundaries at the widget's width.