JengaBox

fun JengaBox(modifier: Modifier = Modifier, padding: PaddingValues = PaddingValues(0.dp), background: Color = Color.Unspecified, shape: Shape = RectangleShape, border: BorderStroke? = null, contentAlignment: Alignment = Alignment.TopStart, content: @Composable BoxScope.() -> Unit)(source)

The primitive styled container: a Box that bundles the common padding / background / shape / border into parameters, so feature code stops writing Modifier.clip().background().border().padding() chains. (Polaris / Chakra Box.)

Parameters

modifier

the Modifier for the box (applied outside the styling).

padding

inner padding; defaults to none.

background

fill color; Color.Unspecified means no fill.

shape

the clip/background/border shape; defaults to a rectangle.

border

optional border stroke.

contentAlignment

alignment of the content within the box.

content

the box content, in a BoxScope.

Samples

JengaBox(
    padding = PaddingValues(
        all = 16.dp,
    ),
    background = JengaTheme.colors.brandSubtle,
    content = {
        JengaText(
            text = "Boxed",
            color = JengaTheme.colors.onBrandSubtle,
        )
    },
)