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

# rightBarButtonItem

A custom bar button item that displays on the right (or trailing) edge of the navigation bar when the navigation item is the top item.

```
var rightBarButtonItem: UIBarButtonItem? { get set }
```

## Discussion

The contents of this property always refer to the first bar button item in the [`rightBarButtonItems`](/documentation/UIKit/UINavigationItem/rightBarButtonItems) array. Assigning a new value to this property replaces the first item in the [`rightBarButtonItems`](/documentation/UIKit/UINavigationItem/rightBarButtonItems) array with the new value. Setting this property to `nil` removes the first item in the array. If the bar button item is already in the array, it is moved from its current location to the front of the array.

In a right-to-left user interface, the position of the right bar button item is automatically flipped.

---

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)