<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSButton/ButtonType/toggle",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@E@NSButtonType@NSButtonTypeToggle"
  },
  "title" : "NSButton.ButtonType.toggle"
}
-->

# NSButton.ButtonType.toggle

A button that switches between its normal and alternate content on each click.

```
case toggle
```

## Discussion

When the value of [`state`](/documentation/AppKit/NSButton/state) is [`off`](/documentation/AppKit/NSControl/StateValue/off), the button displays its normal content, such as its [`image`](/documentation/AppKit/NSButton/image) or [`title`](/documentation/AppKit/NSButton/title). When [`state`](/documentation/AppKit/NSButton/state) has any other value, the button displays its alternate content, such as its [`alternateImage`](/documentation/AppKit/NSButtonCell/alternateImage) or [`alternateTitle`](/documentation/AppKit/NSButton/alternateTitle) instead. If the button has no alternate content to display, it may instead draw its normal content using an illuminated effect.

This type of button is best for controlling a Boolean state within your application, while also providing a visual indication of that state.

This option corresponds to the Toggle type in Interface Builder’s Attributes Inspector.

---

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)