<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSButtonCell/keyEquivalent",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSButtonCell(py)keyEquivalent"
  },
  "title" : "keyEquivalent"
}
-->

# keyEquivalent

The button’s key-equivalent character.

```
var keyEquivalent: String { get set }
```

## Discussion

The value of this property is the string that contains the key equivalent character of the button, or the empty string if one hasn’t been defined. Buttons don’t have a default key equivalent.

Setting this property redraws the button’s inside if it displays a key equivalent instead of an image. The key equivalent isn’t displayed if the image position is set to `NSNoImage`, `NSImageOnly`, or `NSImageOverlaps`; that is, the button must display both its title and its “image” (the key equivalent in this case), and they must not overlap.

To display a key equivalent on a button, set the image and alternate image to `nil`, then set the key equivalent, then set the image position.

## See Also

[`image`](/documentation/AppKit/NSCell/image)

The image displayed by the cell, if any.

[`alternateImage`](/documentation/AppKit/NSButtonCell/alternateImage)

The image the button displays in its alternate state.

[`imagePosition`](/documentation/AppKit/NSButtonCell/imagePosition)

The position of the button’s image relative to its title.



---

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)