Contents

textInputBorderShape(_:)

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

Declaration

nonisolated func textInputBorderShape(_ shape: TextInputBorderShape) -> some View

Parameters

  • shape:

    The shape to use for the border of text input controls.

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

Managing text entry