---
title: "init(role:intent:label:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/button/init(role:intent:label:)"
---

# init(role:intent:label:)

Creates a button with a specified role that performs an AppIntent.

## Declaration

```swift
nonisolated init(role: ButtonRole?, intent: some AppIntent, @ViewBuilder label: () -> Label)
```

## Parameters

- `role`: An optional semantic role describing the button. A value of nil means that the button doesn’t have an assigned role.
- `intent`: The AppIntent to execute.
- `label`: A view that describes the purpose of the button’s action.

## See Also

### Creating a button to perform an App Intent

- [init(_:intent:)](swiftui/button/init(_:intent:).md)
- [init(intent:label:)](swiftui/button/init(intent:label:).md)
- [init(_:role:intent:)](swiftui/button/init(_:role:intent:).md)
- [init(_:image:role:intent:)](swiftui/button/init(_:image:role:intent:).md)
- [init(_:systemImage:role:intent:)](swiftui/button/init(_:systemimage:role:intent:).md)
