<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSButton/highlight(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSButton(im)highlight:"
  },
  "title" : "highlight(_:)"
}
-->

# highlight(_:)

Highlights (or unhighlights) the button.

```
func highlight(_ flag: Bool)
```

## Parameters

`flag`

<doc://com.apple.documentation/documentation/Swift/true> to highlight the button; <doc://com.apple.documentation/documentation/Swift/false> to unhighlight the button.  If the current state of the button matches `flag`, no action is taken.

## Discussion

Highlighting makes the button appear recessed, displays its alternate title or image, or causes the button to appear illuminated.

## See Also

[`-  setButtonType:`](/documentation/AppKit/NSButton/setButtonType(_:))

Sets the button’s type, which affects its user interface and behavior when clicked.



---

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)