Compose SwiftUIv0.4.0
esc
GuideAPIGitHub
View modifier

background(_:)

Draws a style or a view behind a view.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
fun Modifier.background(ignoresSafeAreaEdges: Edge.Set = Edge.Set.all): Modifier

Overview

Text("New", modifier = Modifier.padding().background(Color.blue.opacity(0.2), Capsule()))

This is the Kotlin form of SwiftUI View.background(ignoresSafeAreaEdges:): SwiftUI documentation. In Swift it reads:

nonisolated func background(ignoresSafeAreaEdges edges: Edge.Set = .all) -> some View

Topics

Overloads

fun Modifier.background(style: ShapeStyle, shape: InsettableShape, fillStyle: FillStyle = FillStyle()): Modifier
SwiftUI View.background(_:in:fillStyle:)
fun Modifier.background(shape: InsettableShape, fillStyle: FillStyle = FillStyle()): Modifier
SwiftUI View.background(in:fillStyle:)
fun Modifier.background(alignment: Alignment = Alignment.center, content: @Composable () -> Unit): Modifier
SwiftUI View.background(alignment:content:)
fun Modifier.background(style: ShapeStyle, ignoresSafeAreaEdges: Edge.Set = Edge.Set.all): Modifier
SwiftUI View.background(_:ignoresSafeAreaEdges:)
fun Modifier.background(ignoresSafeAreaEdges: Edge.Set = Edge.Set.all): Modifier
SwiftUI View.background(ignoresSafeAreaEdges:)
fun Modifier.background(style: ShapeStyle, shape: Shape, fillStyle: FillStyle = FillStyle()): Modifier
SwiftUI View.background(_:in:fillStyle:)
fun Modifier.background(shape: Shape, fillStyle: FillStyle = FillStyle()): Modifier
SwiftUI View.background(in:fillStyle:)