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

# titleMenuProvider

A closure that generates the navigation item’s title menu.

```
var titleMenuProvider: (([UIMenuElement]) -> UIMenu?)? { get set }
```

## Discussion

UIKit calls this closure to create a context menu that appears when a person taps the title of the navigation item. UIKit passes in a set of menu element suggestions that you can either use directly or modify in this closure to customize the menu.

```swift
// Use suggested menu elements directly.
navigationItem.titleMenuProvider = { suggestions in
    return UIMenu(children: suggestions)
}

// Add a custom menu element to the suggestions.
navigationItem.titleMenuProvider = { suggestions in
    var finalMenuElements = suggestions
    finalMenuElements.append(UICommand(title: "Save", 
                                       image: UIImage(systemName: "square.and.arrow.down"), 
                                      action: #selector(self.save)))
    return UIMenu(children: finalMenuElements)
}
```

Before displaying the title menu, UIKit validates each element in the menu you return by traversing the responder chain, starting with the navigation controller’s [`topViewController`](/documentation/UIKit/UINavigationController/topViewController). For selector-based menu elements, implement your methods on [`topViewController`](/documentation/UIKit/UINavigationController/topViewController) or farther up in the responder chain if you want those elements to appear in the title menu. For more information, see [`canPerformAction(_:withSender:)`](/documentation/UIKit/UIResponder/canPerformAction(_:withSender:)).

> Tip:
> You don’t need to assign a ``doc://com.apple.uikit/documentation/UIKit/UINavigationItem/titleMenuProvider`` if you only want to show Rename in your title menu. If you assign a `renameDelegate` without setting a ``doc://com.apple.uikit/documentation/UIKit/UINavigationItem/titleMenuProvider``, UIKit automatically generates a title menu containing the Rename menu element only.

---

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)