---
title: "setBadgeTextAttributes(_:for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitabbaritem/setbadgetextattributes(_:for:)"
---

# setBadgeTextAttributes(_:for:)

Registers text attributes that the badge uses for the specified state.

## Declaration

```swift
func setBadgeTextAttributes(_ textAttributes: [NSAttributedString.Key : Any]?, for state: UIControl.State)
```

## Parameters

- `textAttributes`: A dictionary of text attributes. For a list of possible attributes, see doc://com.apple.documentation/documentation/Foundation/NSAttributedString/Key.
- `state`: The item’s state. For possible values, see doc://com.apple.uikit/documentation/UIKit/UIControl/State-swift.struct.

## Discussion

Discussion The setTitleTextAttributes(_:for:) method allows you to customize the appearance of the item’s title. Use this method to apply similar customizations to the badge’s value to achieve a consistent appearance.

## See Also

### Configuring the item’s badge

- [badgeValue](uikit/uitabbaritem/badgevalue.md)
- [badgeColor](uikit/uitabbaritem/badgecolor.md)
- [badgeTextAttributes(for:)](uikit/uitabbaritem/badgetextattributes(for:).md)
