<!--
{
  "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/underline(_:color:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4TextV9underline_5colorACSb_AA5ColorVSgtF"
  },
  "title" : "underline(_:color:)"
}
-->

# underline(_:color:)

Applies an underline to the text.

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

## Parameters

`isActive`

A Boolean value that indicates whether the text has an
underline.

`color`

The color of the underline. If `color` is `nil`, the
underline uses the default foreground color.

## Return Value

Text with a line running along its baseline.

---

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)