---
title: "popUpContextMenu(_:with:for:with:)"
framework: appkit
role: symbol
role_heading: Type Method
path: "appkit/nsmenu/popupcontextmenu(_:with:for:with:)"
---

# popUpContextMenu(_:with:for:with:)

Displays a contextual menu over a view for an event using a specified font.

## Declaration

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

## Parameters

- `menu`: The menu object to use for the contextual menu.
- `event`: An doc://com.apple.appkit/documentation/AppKit/NSEvent object representing the event.
- `view`: The view object over which to display the contextual menu.
- `font`: An doc://com.apple.appkit/documentation/AppKit/NSFont object representing the font for the contextual menu. If you pass in nil for the font, the method uses the default font for menu.

## Discussion

Discussion Specifying a font using the font parameter is discouraged. Instead, set the menu’s font using the font property, then pass nil for the font parameter.

## See Also

### Displaying Context-Sensitive Help

- [popUpContextMenu(_:with:for:)](appkit/nsmenu/popupcontextmenu(_:with:for:).md)
- [helpRequested(with:)](appkit/nsmenu/helprequested(with:).md)
- [popUp(positioning:at:in:)](appkit/nsmenu/popup(positioning:at:in:).md)
