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

# underline(_:pattern:color:)

Applies an underline to the text in this view.

## Declaration

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

```

## Parameters

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

## Return Value

Return Value A view where text has a line running along its baseline.

## See Also

### Controlling text style

- [bold(_:)](swiftui/view/bold(_:).md)
- [italic(_:)](swiftui/view/italic(_:).md)
- [strikethrough(_:pattern:color:)](swiftui/view/strikethrough(_:pattern:color:).md)
- [textCase(_:)](swiftui/view/textcase(_:).md)
- [textCase](swiftui/environmentvalues/textcase.md)
- [monospaced(_:)](swiftui/view/monospaced(_:).md)
- [monospacedDigit()](swiftui/view/monospaceddigit().md)
- [AttributedTextFormattingDefinition](swiftui/attributedtextformattingdefinition.md)
- [AttributedTextValueConstraint](swiftui/attributedtextvalueconstraint.md)
- [AttributedTextFormatting](swiftui/attributedtextformatting.md)
