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

# padding(_:)

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

## Declaration

```swift
nonisolated func padding(_ length: CGFloat) -> some View

```

## Parameters

- `length`: The amount, given in points, to pad this view on all edges.

## Return Value

Return Value A view that’s padded by the amount you specify.

## Discussion

Discussion Use this modifier to add padding all the way around a view. VStack {     Text("Text padded by 10 points on each edge.")         .padding(10)         .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 independently control the amount of padding for each edge, use padding(_:). To pad a select set of edges by the same amount, use padding(_:_:).
