spacer

Function spacer 

Source
pub fn spacer(args: impl Into<SpacerArgs>)
Expand description

§spacer

Renders an empty, flexible space to influence layout.

§Usage

Add fixed-size gaps or create flexible space that pushes other components apart.

§Parameters

  • args — configures the spacer’s width and height; see SpacerArgs.

§Examples

use tessera_ui_basic_components::{
    row::{row, RowArgs},
    spacer::{spacer, SpacerArgs},
    text::{text, TextArgsBuilder},
};

row(RowArgs::default(), |scope| {
    scope.child(|| text(TextArgsBuilder::default().text("Left".to_string()).build().expect("builder construction failed")));
    // This spacer will fill the available width, pushing "Right" to the end.
    scope.child(|| spacer(SpacerArgs::fill_width()));
    scope.child(|| text(TextArgsBuilder::default().text("Right".to_string()).build().expect("builder construction failed")));
});