<div class='type'>Compose Modifier</div>

<a id='references'></a>


<h2 id="background-color-shape">background</h2>

<div class='sourceset sourceset-common'>Common</div>


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


Draws `shape` with a solid `color` behind the content.

#### Parameters

| | |
| --- | --- |
| color | color to paint background with |
| shape | desired shape of the background |






<hr class="docs-overload-divider">


<h2 id="background-brush-shape">background</h2>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Modifier.background(
    brush: Brush,
    shape: Shape = RectangleShape,
    @FloatRange(from = 0.0, to = 1.0) alpha: Float = 1.0f,
) =
    this.then(
        BackgroundElement(
            brush = brush,
            alpha = alpha,
            shape = shape,
            inspectorInfo =
                debugInspectorInfo {
                    name = "background"
                    properties["alpha"] = alpha
                    properties["brush"] = brush
                    properties["shape"] = shape
                },
        )
    )
```


Draws `shape` with `brush` behind the content.

#### Parameters

| | |
| --- | --- |
| brush | brush to paint background with |
| shape | desired shape of the background |
| alpha | 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`. |