class RatatuiRuby::Widgets::Paragraph

Displays a block of text.

Raw strings are insufficient for UIs. They overflow constraints. They don’t respect alignment (left, center, right).

This widget creates a smart text container. It wraps content to fit the area. It aligns text as requested. It supports scrolling.

Use it for everything from simple labels to complex, multi-paragraph documents.

See also: examples/widget_scroll_text/app.rb for scrollable paragraphs.

Examples

# Basic Text
Paragraph.new(text: "Hello, World!")

# Styled container with wrapping
Paragraph.new(
  text: "This is a long line that will wrap automatically.",
  style: Style.new(fg: :green),
  wrap: true,
  block: Block.new(title: "Output", borders: [:all])
)

# Scrolling mechanism
Paragraph.new(text: large_text, scroll: [scroll_y, 0])