Compose Modifier

absolutePadding

Apply additional space along each edge of the content in Dp: left, top, right and bottom.

AbsolutePaddingModifier

@Sampled
@Composable
fun AbsolutePaddingModifier() {
    Box(Modifier.background(color = Color.Gray)) {
        Box(
            Modifier.absolutePadding(left = 20.dp, top = 30.dp, right = 20.dp, bottom = 30.dp)
                .size(50.dp)
                .background(Color.Blue)
        )
    }
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: