textInputBorderShape

Sets the border shape for text input controls in the view hierarchy.

View ModifieriOS 27.0+macOS 27.0+tvOS 27.0+watchOS 27.0+visionOS 27.0+textInputBorderShape(_:) in SwiftUI

Declaration

React
compose().textInputBorderShape(
  shape: SwiftUI.TextInputBorderShape
)
Swift
nonisolated func textInputBorderShape(
    _ shape: TextInputBorderShape
) -> some View

Parameters

Discussion

Use this modifier to customize the border shape of TextField and other text input controls. The shape can be applied to individual controls or to a container to affect all text input controls within it.

In this example, a search field and button both use a capsule shape:

HStack {
    TextField("Search", text: $searchText)
    Button("Go", action: search)
}
.buttonBorderShape(.capsule)
.textInputBorderShape(.capsule)

See also

More in Drawing and shapes.