---
title: "underline(_:pattern:color:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/text/underline(_:pattern:color:)"
---

# underline(_:pattern:color:)

Applies an underline to the text.

## Declaration

```swift
nonisolated func underline(_ isActive: Bool = true, pattern: Text.LineStyle.Pattern, color: Color? = nil) -> Text
```

## Parameters

- `isActive`: A Boolean value that indicates whether underline styling is added. The default value is true.
- `pattern`: The pattern of the line.
- `color`: The color of the underline. If color is nil, the underline uses the default foreground color.

## Return Value

Return Value Text with a line running along its baseline.

## 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)
- [monospaced(_:)](swiftui/text/monospaced(_:).md)
- [monospacedDigit()](swiftui/text/monospaceddigit().md)
- [kerning(_:)](swiftui/text/kerning(_:).md)
- [tracking(_:)](swiftui/text/tracking(_:).md)
- [baselineOffset(_:)](swiftui/text/baselineoffset(_:).md)
- [Text.Case](swiftui/text/case.md)
- [Text.DateStyle](swiftui/text/datestyle.md)
