---
title: "highlight(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbutton/highlight(_:)"
---

# highlight(_:)

Highlights (or unhighlights) the button.

## Declaration

```swift
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

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

## See Also

### Related Documentation

- [setButtonType(_:)](appkit/nsbutton/setbuttontype(_:).md)

### Managing button state

- [allowsMixedState](appkit/nsbutton/allowsmixedstate.md)
- [state](appkit/nsbutton/state.md)
- [setNextState()](appkit/nsbutton/setnextstate().md)
