<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIMenuElement/highlightStateUpdateHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIMenuElement(py)highlightStateUpdateHandler"
  },
  "title" : "highlightStateUpdateHandler"
}
-->

# highlightStateUpdateHandler

A closure the system calls when the element’s highlight state changes in a menu.

```
var highlightStateUpdateHandler: ((UIMenuElement, Bool) -> Void)? { get set }
```

## Discussion

The system calls this handler whenever a menu element transitions between highlighted and unhighlighted states. Highlight events include pointer hover, touch down, keyboard navigation, and focus changes.

The handler receives two parameters: the affected element and a Boolean that indicates the new state. When `isHighlighted` is <doc://com.apple.documentation/documentation/Swift/true>, the element is highlighted. When it’s <doc://com.apple.documentation/documentation/Swift/false>, the element is unhighlighted.

Use this handler to update your app’s UI in response to the user’s attention on a menu element, such as showing a preview of the action’s effect while the user considers the option.

> Note: In visionOS, the system doesn’t call this handler for gaze-based highlight.

---

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)