---
title: "padding(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/padding(_:)"
---

# padding(_:)

Adds a different padding amount to each edge of this view.

## Declaration

```swift
nonisolated func padding(_ insets: EdgeInsets) -> some View

```

## Parameters

- `insets`: An doc://com.apple.SwiftUI/documentation/SwiftUI/EdgeInsets instance that contains padding amounts for each edge.

## Return Value

Return Value A view that’s padded by different amounts on each edge.

## Discussion

Discussion Use this modifier to add a different amount of padding on each edge of a view: VStack {     Text("Text padded by different amounts on each edge.")         .padding(EdgeInsets(top: 10, leading: 20, bottom: 40, trailing: 0))         .border(.gray)     Text("Unpadded text for comparison.")         .border(.yellow) } The order in which you apply modifiers matters. The example above applies the padding before applying the border to ensure that the border encompasses the padded region:

To pad a view on specific edges with equal padding for all padded edges, use padding(_:_:). To pad all edges of a view equally, use padding(_:).

## See Also

### Adding padding around a view

- [padding(_:_:)](swiftui/view/padding(_:_:).md)
- [padding3D(_:)](swiftui/view/padding3d(_:).md)
- [padding3D(_:_:)](swiftui/view/padding3d(_:_:).md)
- [scenePadding(_:)](swiftui/view/scenepadding(_:).md)
- [scenePadding(_:edges:)](swiftui/view/scenepadding(_:edges:).md)
- [ScenePadding](swiftui/scenepadding.md)
