<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ButtonRole",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10ButtonRoleV"
  },
  "title" : "ButtonRole"
}
-->

# ButtonRole

A value that describes the purpose of a button.

```
struct ButtonRole
```

## Overview

A button role provides a description of a button’s purpose.  For example,
the [`destructive`](/documentation/SwiftUI/ButtonRole/destructive) role indicates that a button performs
a destructive action, like delete user data:

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

## Topics

### Getting button roles

[`cancel`](/documentation/SwiftUI/ButtonRole/cancel)

A role that indicates a button that cancels an operation.

[`destructive`](/documentation/SwiftUI/ButtonRole/destructive)

A role that indicates a destructive button.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)