---
title: NSMenuItemBadge
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsmenuitembadge
---

# NSMenuItemBadge

A control that provides additional quantitative information specific to a menu item, such as the number of available updates.

## Declaration

```swift
class NSMenuItemBadge
```

## Overview

Overview You create a badge using an initializer or a predefined factory method, and then you assign it to the badge property of a NSMenuItem for display.

For example, to display a badge with a count, use the init(count:) initalizer, passing in the value of count as an Int. To display a badge with a custom string, use the init(string:) initializer, passing in the string you want to display. To display a badge using a predefined NSMenuItemBadge.BadgeType, use a factory method such as newItems(count:), passing in the count of the badge to display. important: If you use one of the predefined badge types, the system localizes and pluralizes the string for you. If you create your own custom badge string, you need to localize and pluralize that string yourself. For more information on how to localize and pluralize text, see Localizing and varying text with a string catalog. The default value of this property is nil.

## Topics

### Creating menu item badges

- [init(count:)](appkit/nsmenuitembadge/init(count:).md)
- [init(string:)](appkit/nsmenuitembadge/init(string:).md)

### Creating badges of a specific type

- [alerts(count:)](appkit/nsmenuitembadge/alerts(count:).md)
- [newItems(count:)](appkit/nsmenuitembadge/newitems(count:).md)
- [updates(count:)](appkit/nsmenuitembadge/updates(count:).md)
- [NSMenuItemBadge.BadgeType](appkit/nsmenuitembadge/badgetype.md)

### Accessing menu item badge attributes

- [itemCount](appkit/nsmenuitembadge/itemcount.md)
- [stringValue](appkit/nsmenuitembadge/stringvalue-fc9f.md)
- [type](appkit/nsmenuitembadge/type.md)

### Instance Properties

- [stringValue](appkit/nsmenuitembadge/stringvalue-32sbt.md)

## Relationships

### Inherits From

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

### Conforms To

- [CVarArg](swift/cvararg.md)
- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Menus

- [NSMenu](appkit/nsmenu.md)
- [NSMenuItem](appkit/nsmenuitem.md)
- [NSMenuDelegate](appkit/nsmenudelegate.md)
