Skip to main content

boxed

Function boxed 

Source
pub fn boxed() -> BoxedBuilder
Expand description

§boxed

A container that overlays its children, aligning them relative to each other.

§Usage

Stack children on top of each other to create layered interfaces, such as a badge on an icon or text over an image.

§Parameters

  • alignment — default alignment applied to children without parent data.
  • modifier — modifier chain applied to the boxed container.
  • children — child slot rendered inside the boxed container.

§Examples

use tessera_components::{
    alignment::Alignment, boxed::boxed, modifier::ModifierExt as _, text::text,
};
use tessera_ui::Modifier;

boxed().children(|| {
    text("Background");
    text("Foreground")
        .modifier(Modifier::new().align(Alignment::Center));
});