<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ToggleStyle/checkbox",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11ToggleStylePA2A08CheckboxcD0VRszrlE8checkboxAEvpZ"
  },
  "title" : "checkbox"
}
-->

# checkbox

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

```
@export(implementation) nonisolated static var checkbox: CheckboxToggleStyle { get }
```

## Discussion

Apply this style to a [`Toggle`](/documentation/SwiftUI/Toggle) or to a view hierarchy that contains
toggles using the [`toggleStyle(_:)`](/documentation/SwiftUI/View/toggleStyle(_:)) modifier:

```
Toggle("Close windows when quitting an app", isOn: $doesClose)
    .toggleStyle(.checkbox)
```

The style produces a label that describes the purpose of the toggle
and a checkbox that shows the toggle’s state. To change the toggle’s
state, the user clicks the checkbox or its label:

![A screenshot of a box with a checkmark in it, appearing to the left](images/com.apple.SwiftUI/ToggleStyle-checkbox-1-macOS@2x.png)

The style aligns the trailing edge of the checkbox with the leading edge
of the label, and takes as much horizontal space as it needs to fit the
label, up to the amount offered by the toggle’s parent view.

This is the default style in macOS in most contexts when
you don’t set a style, or when you apply the [`automatic`](/documentation/SwiftUI/ToggleStyle/automatic)
style. A [`Form`](/documentation/SwiftUI/Form) is a convenient way to present a collection of
checkboxes with proper spacing and alignment. For guidance on using
checkboxes in your user interface, see
<doc://com.apple.documentation/design/Human-Interface-Guidelines/toggles>
in the Human Interface Guidelines.

---

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)