androidx.compose.foundation

background

Function · from org.jetbrains.compose.foundation:foundation:1.12.2

No hand-written docs yet.

Draws shape with a solid color behind the content.

With color

fun Modifier.background(
    color: Color,
    shape: Shape = RectangleShape,
): Modifier

color: ColorRequired

color to paint background with

shape: ShapeOptional

Default: RectangleShape

desired shape of the background

With brush, alpha

fun Modifier.background(
    brush: Brush,
    shape: Shape = RectangleShape,
    alpha: Float = 1.0f,
)

brush: BrushRequired

brush to paint background with

alpha: FloatOptional

Default: 1.0f

Opacity to be applied to the brush, with 0 being completely transparent and 1 being completely opaque. The value must be between 0 and 1.

Same as above: shape.

Library docs

Draws shape with a solid color behind the content.