Skip to content

Button Styles and Roles (SwiftUI)

A SwiftUI guide for coding agents. Also covers bordered button style, borderedprominent, button role destructive, tint modifier, controlsize button, buttonbordershape capsule.

Since iOS 15, system button styles compose from four modifiers: a style (bordered or borderedProminent), tint, controlSize, and buttonBorderShape. Together they cover most button designs without a custom ButtonStyle.

Roles

The optional role parameter (destructive or cancel) tells the system what the button means. A destructive button tints red, and the role carries into context menus, toolbar menus, and alerts.

Button("Delete", role: .destructive) {
  viewModel.delete()
}

Menu("Actions") {
  Button("New action") {}
  Button("Delete", role: .destructive) {}
}

Composing the Look

Button("New action") {}
  .buttonStyle(.borderedProminent)
  .tint(.green)
  .buttonBorderShape(.capsule)
  .controlSize(.large)
  • .bordered gives the tinted, rounded-corner background used across iOS system UI; .borderedProminent fills the button with the tint color for the primary action.
  • tint overrides the accent color, and unlike the app accent color it always wins, even against user preference.
  • controlSize (mini, small, regular, large) sizes every control in the hierarchy. It is also the only handle on a bordered button's corner radius, which grows with the size.
  • buttonBorderShape picks the outline: capsule, roundedRectangle, or automatic.

All four propagate through the environment, so setting them on a container styles every button inside it consistently.

Use this guidance in your coding agent

Install the Better Design MCP once. Your agent then loads this page with one call.

get-swiftui-guide({ topic: "swiftui-the-many-faces-of-button" })
claude mcp add --scope user better-design --transport http https://better-design.com/api/mcp --header "Authorization: Bearer <YOUR_API_KEY>"
Browse related design systems