---
title: "init(_:isOn:action:valueLabel:)"
framework: widgetkit
role: symbol
role_heading: Initializer
path: "widgetkit/controlwidgettoggle/init(_:ison:action:valuelabel:)-4lk32"
---

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

Creates a toggle template for a control.

## Declaration

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

## Parameters

- `titleResource`: The localized string resource 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.

## See Also

### Initializers

- [init(isOn:action:label:)](widgetkit/controlwidgettoggle/init(ison:action:label:).md)
- [init(isOn:action:label:valueLabel:)](widgetkit/controlwidgettoggle/init(ison:action:label:valuelabel:).md)
- [init(_:isOn:action:valueLabel:)](widgetkit/controlwidgettoggle/init(_:ison:action:valuelabel:)-33wfq.md)
- [init(_:isOn:action:valueLabel:)](widgetkit/controlwidgettoggle/init(_:ison:action:valuelabel:)-5o6bn.md)
