<!--
{
  "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/Button/init(_:systemImage:role:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6ButtonVA2A5LabelVyAA4TextVAA5ImageVGRszrlE_06systemF04role6actionACyAJGAA18LocalizedStringKeyV_SSAA0C4RoleVSgyyScMYcctcfc::OverloadGroup"
  },
  "title" : "init(_:systemImage:role:action:)"
}
-->

# init(_:systemImage:role:action:)

Creates a button with a specified role that generates its label from a
localized string key and a system image.

```
@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, systemImage: String, role: ButtonRole?, action: @escaping @MainActor () -> Void)
```

## Parameters

`titleKey`

The key for the button’s localized title, that describes
the purpose of the button’s `action`.

`systemImage`

The name of the image resource to lookup.

`role`

An optional semantic role describing the button. A value of
`nil` means that the button doesn’t have an assigned role.

`action`

The action to perform when the user triggers the button.

## Discussion

This initializer creates a [`Label`](/documentation/SwiftUI/Label) view on your behalf, and treats the
localized key similar to [`init(_:tableName:bundle:comment:)`](/documentation/SwiftUI/Text/init(_:tableName:bundle:comment:)). See
[`Text`](/documentation/SwiftUI/Text) for more information about localizing strings.

---

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)