Skip to main content

styled_line

Function styled_line 

Source
pub fn styled_line(
    frame: &mut Frame<'_>,
    area: Rect,
    inlines: &[StyledInline],
    theme: &Theme,
)
Expand description

Render a sequence of styled inline elements as a single line into area.

Equivalent to a borderless StyledText with one line of content, but with no state plumbing — pass inlines + frame + area + theme, get rendered output.

Empty inlines render an empty buffer (no error, no panic). Inlines that exceed the area width are truncated by the underlying ratatui::Paragraph widget; no wrapping is applied (single-line semantics).

§Example

use envision::component::styled_text::StyledInline;
use envision::render::styled_line;
use envision::theme::Theme;
use ratatui::layout::Rect;

fn render(frame: &mut ratatui::Frame, area: Rect, theme: &Theme) {
    let inlines = vec![
        StyledInline::Plain("status: ".to_string()),
        StyledInline::bold("ready".to_string()),
    ];
    styled_line(frame, area, &inlines, theme);
}