column

Function column 

Source
pub fn column<F>(args: ColumnArgs, scope_config: F)
where F: FnOnce(&mut ColumnScope<'_>),
Expand description

§column

A layout component that arranges its children in a vertical column.

§Usage

Stack components vertically, with options for alignment and flexible spacing.

§Parameters

  • args — configures the column’s dimensions and alignment; see ColumnArgs.
  • scope_config — a closure that receives a ColumnScope for adding children.

§Examples

use tessera_ui_basic_components::column::{column, ColumnArgs};
use tessera_ui_basic_components::text::{text, TextArgsBuilder};
use tessera_ui_basic_components::spacer::{spacer, SpacerArgs};

column(ColumnArgs::default(), |scope| {
    scope.child(|| text(TextArgsBuilder::default().text("First item".to_string()).build().expect("builder construction failed")));
    scope.child_weighted(|| spacer(SpacerArgs::default()), 1.0); // This spacer will be flexible
    scope.child(|| text(TextArgsBuilder::default().text("Last item".to_string()).build().expect("builder construction failed")));
});