<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Text/baselineOffset(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4TextV14baselineOffsetyAC14CoreFoundation7CGFloatVF"
  },
  "title" : "baselineOffset(_:)"
}
-->

# baselineOffset(_:)

Sets the vertical offset for the text relative to its baseline.

```
nonisolated func baselineOffset(_ baselineOffset: CGFloat) -> Text
```

## Parameters

`baselineOffset`

The amount to shift the text vertically (up
or down) relative to its baseline.

## Return Value

Text that’s above or below its baseline.

## Discussion

Change the baseline offset to move the text in the view (in points) up
or down relative to its baseline. The bounds of the view expand to
contain the moved text.

```
HStack(alignment: .top) {
    Text("Hello")
        .baselineOffset(-10)
        .border(Color.red)
    Text("Hello")
        .border(Color.green)
    Text("Hello")
        .baselineOffset(10)
        .border(Color.blue)
}
.background(Color(white: 0.9))
```

By drawing a border around each text view, you can see how the text
moves, and how that affects the view.

![Three text views, each with the word “Hello” outlined by a border and](images/com.apple.SwiftUI/SwiftUI-Text-baselineOffset@2x.png)

The first view, with a negative offset, grows downward to handle the
lowered text. The last view, with a positive offset, grows upward. The
enclosing [`HStack`](/documentation/SwiftUI/HStack) instance, shown in gray, ensures all the text views
remain aligned at their top edge, regardless of the offset.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)