<!--
{
  "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/ControlWidgetToggle/init(_:isOn:action:valueLabel:)-33wfq",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "WidgetKit"
    ],
    "preciseIdentifier" : "s:9WidgetKit07ControlA6ToggleVAA7SwiftUI4TextVRszrlE_4isOn6action10valueLabelACyAFq_q0_Gqd___Sbq0_q_Sbctc10AppIntents14SetValueIntentR0_SyRd__Sb0P4TypeRt0_lufc"
  },
  "title" : "init(_:isOn:action:valueLabel:)"
}
-->

# init(_:isOn:action:valueLabel:)

Creates a toggle template for a control.

```
@MainActor @preconcurrency init(_ title: some StringProtocol, isOn: Bool, action: Action, @ViewBuilder valueLabel: @escaping (Bool) -> ValueLabel) where Action : SetValueIntent, Action.ValueType == Bool
```

## Parameters

`title`

A string to display as the title of the toggle.

`isOn`

A boolean value that describes the current value of the
toggle.

`action`

The action the toggle performs when pressed.

`valueLabel`

A view that renders the toggle’s value. The boolean
parameter represents the value.

---

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)