---
title: "webViewContextMenu(menu:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/webviewcontextmenu(menu:)"
---

# webViewContextMenu(menu:)

Adds an item-based context menu to a WebView, replacing the default set of context menu items.

## Declaration

```swift
nonisolated func webViewContextMenu(@ViewBuilder menu: @escaping @MainActor @Sendable (WebView.ActivatedElementInfo) -> some View) -> some View

```

## Parameters

- `menu`: A closure that produces the menu. The single parameter to the closure describes the type of webpage element that was acted upon.

## Return Value

Return Value A view that can display an item-based context menu.

## See Also

### Displaying web content

- [WebView](webkit/webview-swift.struct.md)
- [WebPage](webkit/webpage.md)
- [onWebViewImmersiveEnvironmentRequest(shouldAllow:present:dismiss:)](swiftui/view/onwebviewimmersiveenvironmentrequest(shouldallow:present:dismiss:).md)
- [webViewBackForwardNavigationGestures(_:)](swiftui/view/webviewbackforwardnavigationgestures(_:).md)
- [webViewContentBackground(_:)](swiftui/view/webviewcontentbackground(_:).md)
- [webViewElementFullscreenBehavior(_:)](swiftui/view/webviewelementfullscreenbehavior(_:).md)
- [webViewLinkPreviews(_:)](swiftui/view/webviewlinkpreviews(_:).md)
- [webViewMagnificationGestures(_:)](swiftui/view/webviewmagnificationgestures(_:).md)
- [webViewOnScrollGeometryChange(for:of:action:)](swiftui/view/webviewonscrollgeometrychange(for:of:action:).md)
- [webViewScrollInputBehavior(_:for:)](swiftui/view/webviewscrollinputbehavior(_:for:).md)
- [webViewScrollPosition(_:)](swiftui/view/webviewscrollposition(_:).md)
- [webViewTextSelection(_:)](swiftui/view/webviewtextselection(_:).md)
