strikethrough

Applies a strikethrough to the text in this view.

View ModifieriOS 16.0+macOS 13.0+tvOS 16.0+watchOS 9.0+strikethrough(_:pattern:color:) in SwiftUI

Declaration

React
compose().strikethrough(
  isActive?: boolean,
  options?: {
    pattern?: SwiftUI.TextLineStylePattern;
    color?: SwiftUI.Color | null;
  }
)
Swift
nonisolated func strikethrough(
    _ isActive: Bool = true,
    pattern: Text.LineStyle.Pattern = .solid,
    color: Color? = nil
) -> some View

Parameters

  • isActiveboolean

    A Boolean value that indicates whether strikethrough is added. The default value is true.

  • The pattern of the line. The default value is solid.

  • options.colorSwiftUI.Color | null

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

Return value

A view where text has a line through its center.

See also

More in Text and symbols.