How it works
BorderlessButtonStyle is a concrete ButtonStyle that draws a button with no border, background fill, or bezel, rendering its label as plain tappable content that takes on the accent color. Reach for it when you want a control to read as lightweight in-line text — an action inside a list row, a toolbar, or a stacked form — rather than as a prominent, filled call-to-action. It is the style SwiftUI applies automatically inside containers like lists and menus, and you apply it explicitly when you want that same flat treatment elsewhere.
Apply it with the buttonStyle(_:) modifier
BorderlessButtonStyle takes effect when you pass an instance of it to the buttonStyle(_:) modifier on a Button. The modifier installs the style into the environment for that button, so the call
.buttonStyle(BorderlessButtonStyle())on theSavebutton replaces the platform's default chrome with the borderless appearance.Construct it with the empty initializer
The type has a single parameterless initializer,
BorderlessButtonStyle(). There are no options to configure — the style fully describes the borderless look on its own, which is why the constructor call is bare in.buttonStyle(BorderlessButtonStyle()).Prefer the .borderless shorthand
Because BorderlessButtonStyle conforms to ButtonStyle and exposes a matching static member, you can write
.borderlessinstead of spelling out the full type. TheCancelbutton uses.buttonStyle(.borderless), which is exactly equivalent to passingBorderlessButtonStyle()but reads more naturally in a modifier chain.Let it cascade through a container
buttonStyle(_:) propagates down the view hierarchy, so a single application can style every button beneath it. Placing the modifier on the enclosing
VStackrather than on eachButtonwould give bothSaveandCancelthe borderless treatment from one call.
.buttonStyle(.borderless) on the Cancel button to .buttonStyle(.borderedProminent) and compare it against the still-borderless Save button to see how much chrome BorderlessButtonStyle strips away.Example & preview
Press Run live & edit to compile it in your browser — then edit the Swift on the left and the preview re-renders live.
struct BorderlessButtonStyleDemo: View {
var body: some View {
VStack(spacing: 16) {
Button("Save") {}
.buttonStyle(BorderlessButtonStyle())
Button("Cancel") {}
.buttonStyle(.borderless)
}
.padding()
}
}