Button Roles
A value that describes the purpose of a button.
Platform Compatibility
iOS 15.0+ iPadOS 15.0+ macOS 12.0+ watchOS 8.0+ tvOS 15.0+ visionOS 1.0+
Tags
SwiftUI Code
VStack {
HStack {
Button("Tap Me", role: .cancel, action: action)
.buttonStyle(.plain)
Button("Tap Me", role: .cancel, action: action)
.buttonStyle(.borderless)
Button("Tap Me", role: .cancel, action: action)
.buttonStyle(.bordered)
Button("Tap Me", role: .cancel, action: action)
.buttonStyle(.borderedProminent)
}
HStack {
Button("Tap Me", role: .destructive, action: action)
.buttonStyle(.plain)
Button("Tap Me", role: .destructive, action: action)
.buttonStyle(.borderless)
Button("Tap Me", role: .destructive, action: action)
.buttonStyle(.bordered)
Button("Tap Me", role: .destructive, action: action)
.buttonStyle(.borderedProminent)
}
}
Found an issue or have a suggestion?
Created: May 30, 2025Updated: August 18, 2026
More Button Components
View allGlass Button Styles
A button style that applies glass border artwork based on the button’s context
Explore Other Components
Browse allMessage Item Alert
Presents an alert with a message using the given data to produce the alert’s content and a localized string key for a title.
VerticalPageTabViewStyle
A TabViewStyle that displays a vertical TabView interaction and appearance.