---
title: "baselineOffset(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/text/baselineoffset(_:)"
---

# baselineOffset(_:)

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

## Declaration

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

## Parameters

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

## Return Value

Return Value Text that’s above or below its baseline.

## Discussion

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.

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 instance, shown in gray, ensures all the text views remain aligned at their top edge, regardless of the offset.

## See Also

### Styling the view’s text

- [foregroundStyle(_:)](swiftui/text/foregroundstyle(_:).md)
- [bold()](swiftui/text/bold().md)
- [bold(_:)](swiftui/text/bold(_:).md)
- [italic()](swiftui/text/italic().md)
- [italic(_:)](swiftui/text/italic(_:).md)
- [strikethrough(_:color:)](swiftui/text/strikethrough(_:color:).md)
- [strikethrough(_:pattern:color:)](swiftui/text/strikethrough(_:pattern:color:).md)
- [underline(_:color:)](swiftui/text/underline(_:color:).md)
- [underline(_:pattern:color:)](swiftui/text/underline(_:pattern:color:).md)
- [monospaced(_:)](swiftui/text/monospaced(_:).md)
- [monospacedDigit()](swiftui/text/monospaceddigit().md)
- [kerning(_:)](swiftui/text/kerning(_:).md)
- [tracking(_:)](swiftui/text/tracking(_:).md)
- [Text.Case](swiftui/text/case.md)
- [Text.DateStyle](swiftui/text/datestyle.md)
