<!--
{
  "documentType" : "article",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/textkit-string-attribute-keys",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "TextKit string attribute keys"
}
-->

# TextKit string attribute keys

UIKit-specific keys you use to apply attributes to ranges of characters in an attributed string.

## Overview

UIKit defines these attribute keys you use to specify attribute values in <doc://com.apple.documentation/documentation/Foundation/NSAttributedString> and <doc://com.apple.documentation/documentation/Foundation/NSMutableAttributedString>.

## Topics

### Getting rendering attribute keys

[`extern NSAttributedStringKey const NSBackgroundColorAttributeName;`](/documentation/UIKit/NSBackgroundColorAttributeName)

The color of the background behind the text.

[`extern NSAttributedStringKey const NSBaselineOffsetAttributeName;`](/documentation/UIKit/NSBaselineOffsetAttributeName)

The vertical offset for the position of the text.

[`extern NSAttributedStringKey const NSFontAttributeName;`](/documentation/UIKit/NSFontAttributeName)

The font of the text.

[`extern NSAttributedStringKey const NSForegroundColorAttributeName;`](/documentation/UIKit/NSForegroundColorAttributeName)

The color of the text.

[`extern NSAttributedStringKey const NSKernAttributeName;`](/documentation/UIKit/NSKernAttributeName)

The kerning of the text.

[`extern NSAttributedStringKey const NSLigatureAttributeName;`](/documentation/UIKit/NSLigatureAttributeName)

The ligature of the text.

[`extern NSAttributedStringKey const NSParagraphStyleAttributeName;`](/documentation/UIKit/NSParagraphStyleAttributeName)

The paragraph style of the text.

[`extern NSAttributedStringKey const NSStrikethroughColorAttributeName;`](/documentation/UIKit/NSStrikethroughColorAttributeName)

The color of the strikethrough.

[`extern NSAttributedStringKey const NSStrikethroughStyleAttributeName;`](/documentation/UIKit/NSStrikethroughStyleAttributeName)

The strikethrough style of the text.

[`extern NSAttributedStringKey const NSStrokeColorAttributeName;`](/documentation/UIKit/NSStrokeColorAttributeName)

The color of the stroke.

[`extern NSAttributedStringKey const NSStrokeWidthAttributeName;`](/documentation/UIKit/NSStrokeWidthAttributeName)

The width of the stroke.

[`extern NSAttributedStringKey const NSTrackingAttributeName;`](/documentation/UIKit/NSTrackingAttributeName)

The amount to modify the default tracking.

[`extern NSAttributedStringKey const NSUnderlineColorAttributeName;`](/documentation/UIKit/NSUnderlineColorAttributeName)

The color of the underline.

[`extern NSAttributedStringKey const NSUnderlineStyleAttributeName;`](/documentation/UIKit/NSUnderlineStyleAttributeName)

The underline style of the text.

[`extern NSAttributedStringKey const NSWritingDirectionAttributeName;`](/documentation/UIKit/NSWritingDirectionAttributeName)

The writing direction of the text.

### Getting text attribute keys

[`extern NSAttributedStringKey const NSLinkAttributeName;`](/documentation/UIKit/NSLinkAttributeName)

The link for the text.

[`extern NSAttributedStringKey const NSShadowAttributeName;`](/documentation/UIKit/NSShadowAttributeName)

The shadow of the text.

[`extern NSAttributedStringKey const NSTextEffectAttributeName;`](/documentation/UIKit/NSTextEffectAttributeName)

An attribute that applies a text effect to the text.

[`extern NSAttributedStringKey const NSTextHighlightColorSchemeAttributeName;`](/documentation/UIKit/NSTextHighlightColorSchemeAttributeName)

The custom highlight color to apply to the text.

[`extern NSAttributedStringKey const NSTextHighlightStyleAttributeName;`](/documentation/UIKit/NSTextHighlightStyleAttributeName)

An attribute that adds a highlight color to the text to emphasize it.

[`extern NSAttributedStringKey const UITextItemTagAttributeName;`](/documentation/UIKit/UITextItemTagAttributeName)

The name of a custom tag associated with a text item.

[`extern NSAttributedStringKey const NSWritingToolsExclusionAttributeName;`](/documentation/UIKit/NSWritingToolsExclusionAttributeName)

### Getting attachment attribute keys

[`extern NSAttributedStringKey const NSAdaptiveImageGlyphAttributeName;`](/documentation/UIKit/NSAdaptiveImageGlyphAttributeName)

The adaptive image glyph for the text.

[`extern NSAttributedStringKey const NSAttachmentAttributeName;`](/documentation/UIKit/NSAttachmentAttributeName)

The attachment for the text.

### Getting accessibility attribute keys

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributeAnnouncementPriority;`](/documentation/UIKit/UIAccessibilitySpeechAttributeAnnouncementPriority)

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributeIPANotation;`](/documentation/UIKit/UIAccessibilitySpeechAttributeIPANotation)

A key that indicates the pronunciation of a specific word or phrase, such as a proper name.

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributeLanguage;`](/documentation/UIKit/UIAccessibilitySpeechAttributeLanguage)

A key that indicates the language to use when speaking a string.

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributePitch;`](/documentation/UIKit/UIAccessibilitySpeechAttributePitch)

A key that indicates the pitch to apply to spoken content.

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributePunctuation;`](/documentation/UIKit/UIAccessibilitySpeechAttributePunctuation)

A key that indicates whether to speak punctuation.

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributeQueueAnnouncement;`](/documentation/UIKit/UIAccessibilitySpeechAttributeQueueAnnouncement)

A key that indicates whether to queue an announcement behind existing speech or to interrupt it.

[`extern NSAttributedStringKey const UIAccessibilitySpeechAttributeSpellOut;`](/documentation/UIKit/UIAccessibilitySpeechAttributeSpellOut)

[`extern NSAttributedStringKey const UIAccessibilityTextAttributeCustom;`](/documentation/UIKit/UIAccessibilityTextAttributeCustom)

A key for specifying custom attributes to apply to the text.

[`extern NSAttributedStringKey const UIAccessibilityTextAttributeHeadingLevel;`](/documentation/UIKit/UIAccessibilityTextAttributeHeadingLevel)

A key for specifying the heading level of the text.

[`extern NSAttributedStringKey const UIAccessibilityTextAttributeContext;`](/documentation/UIKit/UIAccessibilityTextAttributeContext)

### Deprecated keys

[`extern NSAttributedStringKey const NSExpansionAttributeName;`](/documentation/UIKit/NSExpansionAttributeName)

The expansion factor of the text.

[`extern NSAttributedStringKey const NSObliquenessAttributeName;`](/documentation/UIKit/NSObliquenessAttributeName)

The obliqueness of the text.

[`extern NSAttributedStringKey const NSVerticalGlyphFormAttributeName;`](/documentation/UIKit/NSVerticalGlyphFormAttributeName)

The vertical glyph form of the text.



---

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)