Box
A composable that stacks its content in one place, one child over another.
The box asks for the largest size among the children that do not match its own, plus its insets. Each child keeps the size it prefers, capped at the box's inner extent, and sits where contentAlignment puts it. The children stack in declaration order: the last child declared paints over the ones before it, and takes a mouse event at a point they share. A child declaring a zIndex rises over every sibling with a smaller one, wherever the two are declared.
By default the box gives content a zero minimum, so a minimum imposed on the box need not enlarge its children. Set propagateMinConstraints to pass that incoming minimum through instead, such as when content cannot receive a modifier directly.
A child names its own placement with align, or takes the box's whole extent with matchParentSize, through BoxScope:
Box(contentAlignment = Alignment.Center) {
ProgressBar(value = 40, modifier = SwingModifier.matchParentSize())
Label(text = "Loading")
}Parameters
the SwingModifier applied to the panel
where each child sits in the box; the default Alignment.TopStart puts each at the top of the leading edge of the extent available to it
whether the box's incoming minimum extent is passed through to its content. The default false keeps the minimum on the box alone.
the composable content of the box; see BoxScope
A box with no content that can participate in layout, drawing, and input through its modifier.
Parameters
the SwingModifier applied to the panel.