<div class='sourceset sourceset-android'>Android</div>

> **Deprecated** Use padding with start and end instead

<h2 id="padding-left-right">padding</h2>

```kotlin
public fun SubspaceModifier.padding(left: Dp = 0.dp, right: Dp = 0.dp): SubspaceModifier
```

Apply additional space along each edge of the content in [Dp](/jetpack-compose/androidx.compose.ui/ui-unit/classes/Dp): [left](/jetpack-compose/androidx.compose.ui/ui-test/properties/left), [right](/jetpack-compose/androidx.compose.ui/ui-test/properties/right). 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`.

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

<h2 id="padding-start-top-end-bottom-front-back">padding</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun SubspaceModifier.padding(
    start: Dp = 0.dp,
    top: Dp = 0.dp,
    end: Dp = 0.dp,
    bottom: Dp = 0.dp,
    front: Dp = 0.dp,
    back: Dp = 0.dp,
): SubspaceModifier
```

Apply additional space along each edge of the content in [Dp](/jetpack-compose/androidx.compose.ui/ui-unit/classes/Dp): `start`, [top](/jetpack-compose/androidx.compose.ui/ui-test/properties/top), `end`, [bottom](/jetpack-compose/androidx.compose.ui/ui-test/properties/bottom),
`front` and `back`. The start and end edges will be determined by the current [LayoutDirection](/jetpack-compose/androidx.compose.ui/ui-test/functions/LayoutDirection).
Padding is applied before content measurement and takes precedence; content may only be as large
as the remaining space. To not consider the layout direction when applying the padding, see
[absolutePadding](/jetpack-compose/androidx.xr.compose/compose/functions/absolutePadding).

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

#### Parameters

| | |
| --- | --- |
| start | The amount of space at the start edge of the content. Start edge is left if the layout direction is LTR, or right for RTL. |
| top | The amount of space at the top edge of the content. |
| end | The amount of space at the end edge of the content. End edge is right if the layout direction is LTR, or left for RTL. |
| bottom | The amount of space at the bottom edge of the content. |
| front | The amount of space at the front edge of the content. |
| back | The amount of space at the back edge of the content. |

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

<h2 id="padding-horizontal-vertical-depth">padding</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun SubspaceModifier.padding(
    horizontal: Dp = 0.dp,
    vertical: Dp = 0.dp,
    depth: Dp = 0.dp,
): SubspaceModifier
```

Apply `horizontal` dp space along the left and right edges of the content, `vertical` dp space
along the top and bottom edges, and [depth](/jetpack-compose/androidx.xr.compose/compose/functions/depth) dp space along front and back edged. 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 [padding](/jetpack-compose/androidx.xr.compose/compose/functions/padding)

#### Parameters

| | |
| --- | --- |
| horizontal | The amount of space at the left and right edges of the content. |
| vertical | The amount of space at the top and bottom edges of the content. |
| depth | The amount of space at the front and back edges of the content. |

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

<h2 id="padding-all">padding</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun SubspaceModifier.padding(all: Dp): SubspaceModifier
```

Apply `all` dp of additional space along each edge of the content, left, top, right, bottom,
front, and back. 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 [padding](/jetpack-compose/androidx.xr.compose/compose/functions/padding)

#### Parameters

| | |
| --- | --- |
| all | The amount of space at each edge of the content. |