<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UILabel/attributedText",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UILabel(py)attributedText"
  },
  "title" : "attributedText"
}
-->

# attributedText

The styled text that the label displays.

```
@NSCopying var attributedText: NSAttributedString? { get set }
```

## Discussion

This property is `nil` by default.

Assigning a new value to this property also replaces the value of the [`text`](/documentation/UIKit/UILabel/text) property with the same string data, although without any formatting information. In addition, assigning a new value updates the values in the [`font`](/documentation/UIKit/UILabel/font), [`textColor`](/documentation/UIKit/UILabel/textColor), and other style-related properties so that they reflect the style information starting at location `0` in the attributed string.

Turn autokerning on for the label by setting the [`NSKernAttributeName`](/documentation/UIKit/NSKernAttributeName) of the string to <doc://com.apple.documentation/documentation/Foundation/NSNull/null>.

---

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)