pub fn Box<F>(__arg0: Modifier, __arg1: BoxSpec, __arg2: F) -> NodeIdwhere
F: FnMut() + 'static,Expand description
A layout composable that stacks its children on top of each other.
Use Box to:
- Overlay elements (e.g., text over an image).
- Size a child to match its parent.
- Apply a background or border to a single child.
§Arguments
modifier- Modifiers to apply to the box layout.spec- Configuration for content alignment.content- The children composables to layout (z-order is first-to-last).
§Example
ⓘ
Box(
Modifier::size(100.0, 100.0).background(Color::Blue),
BoxSpec::default().content_alignment(Alignment::Center),
|| {
Text("Centered", Modifier::empty());
}
);