pub fn boxed<F>(args: BoxedArgs, scope_config: F)where
F: FnOnce(&mut BoxedScope<'_>),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
args— configures the container’s dimensions and default alignment; seeBoxedArgs.scope_config— a closure that receives aBoxedScopefor adding children.
§Examples
use tessera_ui_basic_components::boxed::{boxed, BoxedArgs};
use tessera_ui_basic_components::text::{text, TextArgsBuilder};
use tessera_ui_basic_components::alignment::Alignment;
boxed(BoxedArgs::default(), |scope| {
// Add a child that will be in the background (rendered first).
scope.child(|| {
text(TextArgsBuilder::default().text("Background".to_string()).build().expect("builder construction failed"));
});
// Add another child aligned to the center, which will appear on top.
scope.child_with_alignment(Alignment::Center, || {
text(TextArgsBuilder::default().text("Foreground".to_string()).build().expect("builder construction failed"));
});
});