Skip to main content

Module text

Module text 

Source
Expand description

Text type for styled text collections.

Text is a higher-level type that collects styled segments and provides ergonomic APIs for text manipulation, styling, and rendering.

§Example

use ftui_text::{Text, Span};
use ftui_style::Style;

// Simple construction
let text = Text::raw("Hello, world!");

// Styled text
let styled = Text::styled("Error!", Style::new().bold());

// Build from spans
let text = Text::from_spans([
    Span::raw("Normal "),
    Span::styled("bold", Style::new().bold()),
    Span::raw(" normal"),
]);

// Chain spans with builder pattern
let text = Text::raw("Status: ")
    .with_span(Span::styled("OK", Style::new().bold()));

Structs§

Line
A single line of styled spans.
Span
A styled span of text.
Text
A collection of styled text spans.