# Toggle

{% tabs %}
{% tab title="💈代碼" %}
```swift
// simple Toggle
Toggle("is compact", isOn: $isCompact)

//                  ╭─── label ───╮
Toggle(isOn: $isOn) { Text("...") }
```
{% endtab %}

{% tab title="💈範例" %}
* [testidealsizeview](../view/layout/frame/.frame/testidealsizeview "mention") - toggle view's state.
{% endtab %}

{% tab title="🔸 定義" %}
```swift
struct Toggle<Label: View>
```
{% endtab %}

{% tab title="📘 手冊" %}
* [SwiftUI](https://developer.apple.com/documentation/swiftui) ⟩ [Views and Controls](https://developer.apple.com/documentation/swiftui/views-and-controls) ⟩&#x20;
  * [Toggle](https://developer.apple.com/documentation/swiftui/toggle) ⟩ [.toggleStyle(\_:)](https://developer.apple.com/documentation/swiftui/view/togglestyle\(_:\))
{% endtab %}

{% tab title="👥 相關" %}
* [label](label "mention")
{% endtab %}
{% endtabs %}
