<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSMenu/popUpContextMenu(_:with:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMenu(cm)popUpContextMenu:withEvent:forView:"
  },
  "title" : "popUpContextMenu(_:with:for:)"
}
-->

# popUpContextMenu(_:with:for:)

Displays a contextual menu over a view for an event.

```
class func popUpContextMenu(_ menu: NSMenu, with event: NSEvent, for view: NSView)
```

## Parameters

`menu`

The menu object to use for the contextual menu.

`event`

An [`NSEvent`](/documentation/AppKit/NSEvent) object representing the event.

`view`

The view object over which to display the contextual menu.

## Discussion

---

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)