---
title: "absolutePadding"
description: "Apply additional space along each edge of the content in [Dp]: [left], [top], [right] and
[bottom]. These paddings are applied without regard to the current [LayoutDirection], see
[padding] to apply relative paddings. Padding is applied before content measurement and takes
precedence; content may only be as large as the remaining space.

Negative padding is not permitted — it will cause [IllegalArgumentException]. See
[Modifier.offset]."
type: "modifier"
---

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

<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun Modifier.absolutePadding(left: Dp = 0.dp, top: Dp = 0.dp, right: Dp = 0.dp, bottom: Dp = 0.dp) =
    this then
        (PaddingElement(
            start = left,
            top = top,
            end = right,
            bottom = bottom,
            rtlAware = false,
            inspectorInfo = {
                name = "absolutePadding"
                properties["left"] = left
                properties["top"] = top
                properties["right"] = right
                properties["bottom"] = bottom
            },
        ))
```


Apply additional space along each edge of the content in `Dp`: `left`, `top`, `right` and
`bottom`. These paddings are applied without regard to the current `LayoutDirection`, see
`padding` to apply relative paddings. Padding is applied before content measurement and takes
precedence; content may only be as large as the remaining space.

Negative padding is not permitted — it will cause `IllegalArgumentException`. See
`Modifier.offset`.



## Code Examples
### AbsolutePaddingModifier
```kotlin
@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)
        )
    }
}
```

