Toggle
Creates a toggle with title, image, systemImage, and custom label.
Platform Compatibility
iOS 13.0+ iPadOS 13.0+ macOS 10.15+ watchOS 6.0+ tvOS 13.0+ visionOS 1.0+
Tags
SwiftUI Code
@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 allExplore Other Components
Browse allBackground Extension Effect
Adds the background extension effect to the view. The view will be duplicated into mirrored copies which will be placed around the view on any edge with available safe area. Additionally, a blur effect will be applied on top to blur out the copies
System Image Label
Creates a label with a system icon image and a title generated from a localized string.
ViewThatFits
A view that adapts to the available space by providing the first child view that fits.
Store View
Creates a view to load and merchandise a collection of products from the App Store using product identifiers. Internally, ProductView is used, and therefore productViewStyle can also be applied here.