---
title: "menuItems(for:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkwebextensioncontext/menuitems(for:)"
---

# menuItems(for:)

Retrieves the menu items for a given tab.

## Declaration

```swift
func menuItems(for tab: any WKWebExtensionTab) -> [UIMenuElement]
```

```swift
func menuItems(for tab: any WKWebExtensionTab) -> [NSMenuItem]
```

## Parameters

- `tab`: The tab for which to retrieve the menu items.

## Discussion

Discussion Returns menu items provided by the extension, allowing the user to perform extension-defined actions on the tab. The app is responsible for displaying these menu items, typically in a context menu or a long-press menu on the tab. note: The properties of the menu items, including the items themselves, can change dynamically. Therefore, the app should fetch the menu items immediately before showing them, to ensure that the most current and relevant items are presented.
