<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WidgetKit",
  "identifier" : "/documentation/WidgetKit/ControlWidgetButton/init(_:action:actionLabel:)-4sgji",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "WidgetKit"
    ],
    "preciseIdentifier" : "s:9WidgetKit07ControlA6ButtonVAA7SwiftUI4TextVRszrlE_6action0H5LabelACyAFq_q0_Gqd___q0_q_Sbctc10AppIntents0J6IntentR0_SyRd__lufc"
  },
  "title" : "init(_:action:actionLabel:)"
}
-->

# init(_:action:actionLabel:)

Creates a button template for a control.

```
@MainActor @preconcurrency init(_ title: some StringProtocol, action: Action, @ViewBuilder actionLabel: @escaping (Bool) -> ActionLabel) where Action : AppIntent
```

## Parameters

`title`

A string to display as the title of the button.

`action`

The action your button performs when pressed.

`actionLabel`

A view that is rendered when the button’s action is performed.

## Discussion

Use the action label to additionally customize the appearance of this
control button while its action is performed

```
ControlWidgetButton(
    configuration.actionName,
    action: OpenTrunkIntent(configuration.id)
) { isActive in
    Image(systemName: "car.side.rear.open.crop")
    if isActive {
        Text("Opening...")
    }
}
```

The example above produces a control button that
appears in Control Center with the value of `actionName` as its title and the provided SF symbol.
While the control is performing, its action it shows the
“Opening…” subtitle.

---

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)