Raxol.UI.Components.Display.Text (Raxol v2.6.1)

View Source

Styled text rendering with wrapping, alignment, and truncation.

Display-only widget -- no keyboard handling.

Props:

  • content (string) -- text to display
  • wrap (:word | :char | :none) -- wrapping mode, default :none

  • white_space (:normal | :nowrap | :pre | :pre_wrap | :pre_line) -- CSS white-space-following collapse/preserve/wrap semantics, default :normal. Only takes effect when set to a value other than :normal; at the default it defers entirely to the legacy wrap prop so existing callers see zero behavior change. See Raxol.UI.TextLayout for the unified wrapping implementation.

  • align (:left | :center | :right) -- alignment within width, default :left

  • width (integer | nil) -- constraint for wrapping/alignment/truncation

  • truncate (boolean) -- truncate with ellipsis when exceeding width, default false
  • text_overflow (:clip | :ellipsis) -- CSS text-overflow-following single-line truncation, default :clip (a no-op; existing rendering already visually clips at the buffer edge). Only takes effect when white_space is :nowrap or :pre (the CSS-spec-following non-wrapping cases) and set to :ellipsis; at any other combination it defers entirely, so existing callers see zero behavior change. See Raxol.UI.TextLayout.truncate/3.

  • line_clamp (pos_integer | nil) -- CSS Overflow Module Level 4 line-clamp: caps wrapped output at this many lines, block-ellipsing the last kept line, default nil (a no-op). When set, it overrides the legacy wrap/truncate dispatch entirely and wraps via white_space (default :normal) through Raxol.UI.TextLayout.clamp/4.

  • style, theme, id -- standard

Summary

Types

t()

@type t() :: %{
  id: String.t() | atom(),
  content: String.t(),
  wrap: :word | :char | :none,
  white_space: Raxol.UI.TextLayout.white_space(),
  align: :left | :center | :right,
  width: non_neg_integer() | nil,
  truncate: boolean(),
  text_overflow: :clip | :ellipsis,
  line_clamp: pos_integer() | nil,
  text_wrap: :auto | :pretty,
  style: map(),
  theme: map()
}

Functions

broadcast(msg)

command(cmd)

handle_event(event, state, context)

Callback implementation for Raxol.UI.Components.Base.Component.handle_event/3.

mount(state)

Callback implementation for Raxol.UI.Components.Base.Component.mount/1.

schedule(msg, delay)

unmount(state)

Callback implementation for Raxol.UI.Components.Base.Component.unmount/1.

update(props, state)

Callback implementation for Raxol.UI.Components.Base.Component.update/2.