BoxScope

sealed interface BoxScope : ConstrainedScope

The receiver of a Box's content, through which a child declares its own placement in that box.

Children are written plainly; what a child declares here rides along on its modifier:

Box {
ProgressBar(value = 40, modifier = SwingModifier.matchParentSize())
Label(text = "Badge", modifier = SwingModifier.align(Alignment.CenterEnd))
}

Functions

Link copied to clipboard
abstract fun SwingModifier.align(alignment: Alignment): SwingModifier

Places the child at alignment on both axes, in place of the box's own contentAlignment.

Link copied to clipboard

Declares element on the child: the LayoutModifierNode it creates measures the child between the constraints this scope's container offers and the child's own measurement, and places it in the extent it reports.

Link copied to clipboard

Gives the child the box's whole extent in place of the extent it prefers, up to an explicit maximumSize where it declares one.