---
title: CPNowPlayingButton
framework: carplay
role: symbol
role_heading: Class
path: carplay/cpnowplayingbutton
---

# CPNowPlayingButton

The abstract base class that Now Playing template buttons use.

## Declaration

```swift
@MainActor class CPNowPlayingButton
```

## Overview

Overview CPNowPlayingButton is an abstract base class for defining buttons that the Now Playing template displays. It provides the common functionality that’s present in all buttons available to the template. You don’t use this class directly, or create your own subclasses. Instead, you must use one of the concrete subclasses that the framework provides, such as CPNowPlayingImageButton or CPNowPlayingShuffleButton.

## Topics

### Creating a Button

- [init(handler:)](carplay/cpnowplayingbutton/init(handler:).md)

### Managing the Button State

- [isEnabled](carplay/cpnowplayingbutton/isenabled.md)
- [isSelected](carplay/cpnowplayingbutton/isselected.md)

### Initializers

- [init(coder:)](carplay/cpnowplayingbutton/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [CPNowPlayingAddToLibraryButton](carplay/cpnowplayingaddtolibrarybutton.md)
- [CPNowPlayingImageButton](carplay/cpnowplayingimagebutton.md)
- [CPNowPlayingMoreButton](carplay/cpnowplayingmorebutton.md)
- [CPNowPlayingPlaybackRateButton](carplay/cpnowplayingplaybackratebutton.md)
- [CPNowPlayingRepeatButton](carplay/cpnowplayingrepeatbutton.md)
- [CPNowPlayingShuffleButton](carplay/cpnowplayingshufflebutton.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)

## See Also

### Managing the Template’s Buttons

- [nowPlayingButtons](carplay/cpnowplayingtemplate/nowplayingbuttons.md)
- [updateNowPlayingButtons(_:)](carplay/cpnowplayingtemplate/updatenowplayingbuttons(_:).md)
- [CPNowPlayingImageButton](carplay/cpnowplayingimagebutton.md)
- [CPNowPlayingAddToLibraryButton](carplay/cpnowplayingaddtolibrarybutton.md)
- [CPNowPlayingMoreButton](carplay/cpnowplayingmorebutton.md)
- [CPNowPlayingPlaybackRateButton](carplay/cpnowplayingplaybackratebutton.md)
- [CPNowPlayingRepeatButton](carplay/cpnowplayingrepeatbutton.md)
- [CPNowPlayingShuffleButton](carplay/cpnowplayingshufflebutton.md)
