<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAlert/showsSuppressionButton",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAlert(py)showsSuppressionButton"
  },
  "title" : "showsSuppressionButton"
}
-->

# showsSuppressionButton

Specifies whether the alert includes a suppression checkbox, which you can employ to allow a user to opt out of seeing the alert again.

```
var showsSuppressionButton: Bool { get set }
```

## Discussion

The default value of this property is <doc://com.apple.documentation/documentation/Swift/false>, which specifies the absence of a suppression checkbox in the alert. Set the value to <doc://com.apple.documentation/documentation/Swift/true> to show a suppression checkbox in the alert.

By default, a suppression checkbox has the title, “Do not show this message again.” In macOS 11.0 and later, if the alert displays multiple buttons that prompt the user to make a choice, the title is “Do not ask again.” To customize it, use the checkbox’s `title` property, as follows:

```swift
myAlert.suppressionButton.title = "Do not show this warning again"
```

To create an alert that responds to the selection state of the suppression checkbox, use code like that shown in Listing 1 to produce the alert shown below.

Listing 1. Creating an alert with a suppression checkbox

```swift
let alertSuppressionKey = "AlertSuppression"
let defaults = UserDefaults.standard

if defaults.bool(forKey: alertSuppressionKey) {
    print("Alert suppressed")
} else {
    let anAlert = NSAlert()
    anAlert.messageText = "Message text."
    anAlert.informativeText = "Informative Text."
    anAlert.showsSuppressionButton = true
    anAlert.runModal()

    if let suppressionButton = anAlert.suppressionButton,
       suppressionButton.state == .on {
        defaults.set(true, forKey: alertSuppressionKey)
    }
}
```

![Alert with a suppression checkbox and customized text](images/com.apple.appkit/media-3686600@2x.png)

---

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)