<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPBarButton",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPBarButton"
  },
  "title" : "CPBarButton"
}
-->

# CPBarButton

A button for placement in a navigation bar.

```
class CPBarButton
```

## Topics

### Creating a CarPlay Bar Button

[`init(coder:)`](/documentation/CarPlay/CPBarButton/init(coder:))

Creates a button initialized  from data in the specified coder object.

[`-  initWithType:handler:`](/documentation/CarPlay/CPBarButton/init(type:handler:))

Creates a bar button with a type and handler.

[`-  initWithImage:handler:`](/documentation/CarPlay/CPBarButton/init(image:handler:))

Creates a bar button that displays an image.

[`-  initWithTitle:handler:`](/documentation/CarPlay/CPBarButton/init(title:handler:))

Creates a bar button that displays a text label.

[`Type`](/documentation/CarPlay/CPBarButton/Type)

Types of bar buttons.

[`CPBarButtonHandler`](/documentation/CarPlay/CPBarButtonHandler)

A block that CarPlay calls when the user taps a bar button.

### Configuring the Button

[`enabled`](/documentation/CarPlay/CPBarButton/isEnabled)

A Boolean value that enables and disables the bar button.

[`image`](/documentation/CarPlay/CPBarButton/image)

The image displayed on the bar button.

[`title`](/documentation/CarPlay/CPBarButton/title)

The title displayed on the bar button.

### Getting the Button Style

[`buttonType`](/documentation/CarPlay/CPBarButton/buttonType)

The display type for the bar button.

[`buttonStyle`](/documentation/CarPlay/CPBarButton/buttonStyle)

The style to use when displaying the button.

[`CPBarButtonStyle`](/documentation/CarPlay/CPBarButtonStyle)

The display style of a bar button.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`NSCoding`](/documentation/Foundation/NSCoding)

### Inherited By

[`CPMessageComposeBarButton`](/documentation/CarPlay/CPMessageComposeBarButton)

---

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)