---
title: "Toggle | Explore SwiftUI"
description: "Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/toggle/toggle"
meta:
  author: "Explore SwiftUI"
  "og:description": "Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Toggle%2Cdescription_~Q3JlYXRlcyBhIHRvZ2dsZSB3aXRoIHRpdGxlLCBpbWFnZSwgc3lzdGVtSW1hZ2UsIGFuZCBjdXN0b20gbGFiZWwu%2Ccategory_Toggle%2Cimage_~L2FwaS9pbWFnZXMvMjA4L3ZhcmlhbnRzLzYyND92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3RvZ2dsZS90b2dnbGUi%2Cs_fEtW3SkTGvVdsfzl.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Toggle | Explore SwiftUI"
  "twitter:description": "Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Toggle%2Cdescription_~Q3JlYXRlcyBhIHRvZ2dsZSB3aXRoIHRpdGxlLCBpbWFnZSwgc3lzdGVtSW1hZ2UsIGFuZCBjdXN0b20gbGFiZWwu%2Ccategory_Toggle%2Cimage_~L2FwaS9pbWFnZXMvMjA4L3ZhcmlhbnRzLzYyND92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3RvZ2dsZS90b2dnbGUi%2Cs_fEtW3SkTGvVdsfzl.png"
  "twitter:title": "Toggle | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone](https://exploreswiftui.com/iphone?element=208) [ Apple Watch](https://exploreswiftui.com/watch?element=208) [ Apple TV](https://exploreswiftui.com/tv?element=208)

# **Toggle**

Creates a toggle with title, image, systemImage, and custom label.

![Toggle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/208/variants/624?v=1790073478842&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 13.0+ iPadOS 13.0+ macOS 10.15+ watchOS 6.0+ tvOS 13.0+ visionOS 1.0+

### **Tags**

### **SwiftUI Code**

[ Docs](https://developer.apple.com/documentation/swiftui/toggle)

```
@State var isOn = false

var body: some View {
    List {
        Toggle("Foo1", isOn: $isOn)
        Toggle("Foo2", image: .cats24X24, isOn: $isOn)
        Toggle("Foo3", systemImage: "star", isOn: $isOn)
        Toggle(isOn: $isOn) {
            Label("Foo4", systemImage: "star")
            Text("Bar")
        }
        Toggle("Foo5", isOn: .constant(true))
    }
}
```

### **Found an issue or have a suggestion?**

Created: July 5, 2026Updated: July 5, 2026

### **More Toggle Components **

[**View all **](https://exploreswiftui.com/library/toggle)

![CheckboxToggleStyle - macOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/212/variants/622?v=1790073478842&r=2&w=412&q=75&f=webp)

### **CheckboxToggleStyle**

A toggle style that displays a checkbox followed by its label.

![SwitchToggleStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/211/variants/640?v=1790073478842&r=2&w=412&q=75&f=webp)

### **SwitchToggleStyle**

A toggle style that displays a leading label and a trailing switch.

![ButtonToggleStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/210/variants/635?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ButtonToggleStyle**

A toggle style that displays as a button with its label as the title.

![Multiple Sources Toggle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/209/variants/633?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Multiple Sources Toggle**

Creates a toggle that updates the selected property for all sources. Once toggled, all sources will have the same value.

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![On Primary Photos Picker Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/267/variants/2251?v=1794910789851&r=2&w=412&q=75&f=webp)

### **On Primary Photos Picker Action**

Sets the primary action handler for the Photos picker.

![BorderedListStyle - macOS - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/101/variants/308?v=1790073478842&r=2&w=412&q=75&f=webp)

### **BorderedListStyle**

The list style that describes the behavior and appearance of a list with standard border.

![Button Tint - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/34/variants/408?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Button Tint**

Sets the buttons tint color

![Picker Section - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/178/variants/544?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Picker Section**

A Section inside a Picker

![Slider Color - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/52/variants/335?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Slider Color**

Customizing the color of the slider

![List Section Margins - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/115/variants/297?v=1790073478842&r=2&w=412&q=75&f=webp)

### **List Section Margins**

Set the section margins for the specific edges.

![UIKit Separator Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/14/variants/57?v=1790073478842&r=2&w=412&q=75&f=webp)

### **UIKit Separator Colors**

The UIKit separator colors that are also used in other components, such as the TextField

![Button Border Shape - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/32/variants/179?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Button Border Shape**

A shape used to draw a button’s border.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/toggle/toggle#webpage","@type":"WebPage","dateModified":"2026-07-05T14:58:29.256Z","datePublished":"2026-07-05T14:56:14.406Z","description":"Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples.","name":"Toggle","url":"https://exploreswiftui.com/library/toggle/toggle","breadcrumb":{"@id":"https://exploreswiftui.com/library/toggle/toggle#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/toggle/toggle#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/toggle/toggle"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/toggle/toggle#article","citation":"https://developer.apple.com/documentation/swiftui/toggle","dateModified":"2026-07-05T14:58:29.256Z","datePublished":"2026-07-05T14:56:14.406Z","description":"Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples.","headline":"Toggle","inLanguage":"en-US","name":"Toggle","thumbnailUrl":"https://exploreswiftui.com/api/images/208/variants/624?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/toggle/toggle","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/toggle/toggle#source-code"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/toggle/toggle#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/toggle/toggle#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/toggle/toggle#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"Creates a toggle with title, image, systemImage, and custom label. Learn how to use Toggle in SwiftUI with visual code examples.","name":"Toggle SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"@State var isOn = false\n\nvar body: some View {\n    List {\n        Toggle(\"Foo1\", isOn: $isOn)\n        Toggle(\"Foo2\", image: .cats24X24, isOn: $isOn)\n        Toggle(\"Foo3\", systemImage: \"star\", isOn: $isOn)\n        Toggle(isOn: $isOn) {\n            Label(\"Foo4\", systemImage: \"star\")\n            Text(\"Bar\")\n        }\n        Toggle(\"Foo5\", isOn: .constant(true))\n    }\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"Toggle"},{"@type":"Thing","name":"Toggle"}]},{"@id":"https://exploreswiftui.com/library/toggle/toggle#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"Toggle","item":"https://exploreswiftui.com/library/toggle","position":2},{"@type":"ListItem","name":"Toggle","item":"https://exploreswiftui.com/library/toggle/toggle","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/208/variants/624?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/208/variants/624?v=1790073478842&r=2"}]}
```