<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ToggleStyleConfiguration",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI24ToggleStyleConfigurationV"
  },
  "title" : "ToggleStyleConfiguration"
}
-->

# ToggleStyleConfiguration

The properties of a toggle instance.

```
struct ToggleStyleConfiguration
```

## Overview

When you define a custom toggle style by creating a type that conforms to
the [`ToggleStyle`](/documentation/SwiftUI/ToggleStyle) protocol, you implement the
[`makeBody(configuration:)`](/documentation/SwiftUI/ToggleStyle/makeBody(configuration:)) method. That method takes a
`ToggleStyleConfiguration` input that has the information you need
to define the behavior and appearance of a [`Toggle`](/documentation/SwiftUI/Toggle).

The configuration structure’s [`label`](/documentation/SwiftUI/ToggleStyleConfiguration/label-swift.property) reflects the
toggle’s content, which might be the value that you supply to the
`label` parameter of the [`init(isOn:label:)`](/documentation/SwiftUI/Toggle/init(isOn:label:)) initializer.
Alternatively, it could be another view that SwiftUI builds from an
initializer that takes a string input, like [`init(_:isOn:)`](/documentation/SwiftUI/Toggle/init(_:isOn:)).
In either case, incorporate the label into the toggle’s view to help
the user understand what the toggle does. For example, the built-in
[`switch`](/documentation/SwiftUI/ToggleStyle/switch) style horizontally stacks the label with the
control element.

The structure’s [`isOn`](/documentation/SwiftUI/ToggleStyleConfiguration/isOn) property provides a [`Binding`](/documentation/SwiftUI/Binding) to the state
of the toggle. Adjust the appearance of the toggle based on this value.
For example, the built-in [`button`](/documentation/SwiftUI/ToggleStyle/button) style fills the button’s
background when the property is `true`, but leaves the background empty
when the property is `false`. Change the value when the user performs
an action that’s meant to change the toggle, like the button does when
tapped or clicked by the user.

## Topics

### Getting the label view

[`label`](/documentation/SwiftUI/ToggleStyleConfiguration/label-swift.property)

A view that describes the effect of switching the toggle between states.

[`Label`](/documentation/SwiftUI/ToggleStyleConfiguration/Label-swift.struct)

A type-erased label of a toggle.

### Managing the toggle state

[`isMixed`](/documentation/SwiftUI/ToggleStyleConfiguration/isMixed)

Whether the [`Toggle`](/documentation/SwiftUI/Toggle) is currently in a mixed state.

[`isOn`](/documentation/SwiftUI/ToggleStyleConfiguration/isOn)

A binding to a state property that indicates whether the toggle is on.

[`$isOn`](/documentation/SwiftUI/ToggleStyleConfiguration/$isOn)



---

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)