underline

Applies an underline to the text.

Text ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+

Overloads

2 ways to call compose().underline(). Each is one SwiftUI overload, picked by the arguments you pass.

React
compose().underline(
  isActive?: boolean,
  options?: {
    color?: SwiftUI.Color | null;
  }
)
Swift
nonisolated func underline(
    _ isActive: Bool = true,
    color: Color? = nil
) -> Text

Parameters

  • isActiveboolean

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

  • options.colorSwiftUI.Color | null

    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.

See also

More in Text modifiers.