pub fn boxed<const N: usize>(
args: BoxedArgs,
children_items_input: [impl AsBoxedItem; N],
)
Expand description
A component that overlays its children on top of each other.
The boxed
component acts as a container that stacks all its child components.
The size of the container is determined by the dimensions of the largest child,
and the alignment of the children within the container can be customized.
It’s useful for creating layered UIs where components need to be placed relative to a common parent.
§Arguments
-
args
: ABoxedArgs
struct that specifies the configuration for the container.alignment
: Controls how children are positioned within the box. SeeAlignment
for available options.width
: The width of the container. Can be fixed, fill the parent, or wrap the content. SeeDimensionValue
for details.height
: The height of the container. Can be fixed, fill the parent, or wrap the content. SeeDimensionValue
for details.
-
children_items_input
: An array of child components to be rendered inside the box. Any component that implements theAsBoxedItem
trait can be a child.
§Example
use tessera_ui_basic_components::boxed::{boxed, BoxedArgs};
use tessera_ui_basic_components::text::text;
boxed(BoxedArgs::default(), [|| text("Hello".to_string())]);