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

# TextKit string attribute keys

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

## Overview

AppKit 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 NSBackgroundColorAttributeName;`](/documentation/AppKit/NSBackgroundColorAttributeName)

The color of the background behind the text.

[`extern NSAttributedStringKey NSBaselineOffsetAttributeName;`](/documentation/AppKit/NSBaselineOffsetAttributeName)

The vertical offset for the position of the text.

[`extern NSAttributedStringKey NSFontAttributeName;`](/documentation/AppKit/NSFontAttributeName)

The font of the text.

[`extern NSAttributedStringKey NSForegroundColorAttributeName;`](/documentation/AppKit/NSForegroundColorAttributeName)

The color of the text.

[`extern NSAttributedStringKey NSGlyphInfoAttributeName;`](/documentation/AppKit/NSGlyphInfoAttributeName)

The name of a glyph info object.

[`extern NSAttributedStringKey NSKernAttributeName;`](/documentation/AppKit/NSKernAttributeName)

The kerning of the text.

[`extern NSAttributedStringKey NSLigatureAttributeName;`](/documentation/AppKit/NSLigatureAttributeName)

The ligature of the text.

[`extern NSAttributedStringKey NSParagraphStyleAttributeName;`](/documentation/AppKit/NSParagraphStyleAttributeName)

The paragraph style of the text.

[`extern NSAttributedStringKey NSStrikethroughColorAttributeName;`](/documentation/AppKit/NSStrikethroughColorAttributeName)

The color of the strikethrough.

[`extern NSAttributedStringKey NSStrikethroughStyleAttributeName;`](/documentation/AppKit/NSStrikethroughStyleAttributeName)

The strikethrough style of the text.

[`extern NSAttributedStringKey NSStrokeColorAttributeName;`](/documentation/AppKit/NSStrokeColorAttributeName)

The color of the stroke.

[`extern NSAttributedStringKey NSStrokeWidthAttributeName;`](/documentation/AppKit/NSStrokeWidthAttributeName)

The width of the stroke.

[`extern NSAttributedStringKey NSSuperscriptAttributeName;`](/documentation/AppKit/NSSuperscriptAttributeName)

The superscript of the text.

[`extern NSAttributedStringKey NSTrackingAttributeName;`](/documentation/AppKit/NSTrackingAttributeName)

The amount to modify the default tracking.

[`extern NSAttributedStringKey NSUnderlineColorAttributeName;`](/documentation/AppKit/NSUnderlineColorAttributeName)

The color of the underline.

[`extern NSAttributedStringKey NSUnderlineStyleAttributeName;`](/documentation/AppKit/NSUnderlineStyleAttributeName)

The underline style of the text.

[`extern NSAttributedStringKey NSWritingDirectionAttributeName;`](/documentation/AppKit/NSWritingDirectionAttributeName)

The writing direction of the text.

### Getting text attribute keys

[`extern NSAttributedStringKey NSCursorAttributeName;`](/documentation/AppKit/NSCursorAttributeName)

The cursor object.

[`extern NSAttributedStringKey NSLinkAttributeName;`](/documentation/AppKit/NSLinkAttributeName)

The link for the text.

[`extern NSAttributedStringKey NSMarkedClauseSegmentAttributeName;`](/documentation/AppKit/NSMarkedClauseSegmentAttributeName)

The index of the marked clause segment.

[`extern NSAttributedStringKey NSShadowAttributeName;`](/documentation/AppKit/NSShadowAttributeName)

The shadow of the text.

[`extern NSAttributedStringKey NSSpellingStateAttributeName;`](/documentation/AppKit/NSSpellingStateAttributeName)

The spelling state of the text.

[`extern NSAttributedStringKey NSTextAlternativesAttributeName;`](/documentation/AppKit/NSTextAlternativesAttributeName)

The alternatives for the text.

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

An attribute that applies a text effect to the text.

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

The custom highlight color to apply to the text.

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

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

[`extern NSAttributedStringKey NSToolTipAttributeName;`](/documentation/AppKit/NSToolTipAttributeName)

The tooltip text.

### Getting attachment attribute keys

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

The adaptive image glyph for the text.

[`extern NSAttributedStringKey NSAttachmentAttributeName;`](/documentation/AppKit/NSAttachmentAttributeName)

The attachment for the text.

### Getting accessibility attribute keys

[`extern NSAttributedStringKey const NSAccessibilityAnnotationTextAttribute;`](/documentation/AppKit/NSAccessibilityAnnotationTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityAutocorrectedTextAttribute;`](/documentation/AppKit/NSAccessibilityAutocorrectedTextAttribute)

Autocorrected text (`NSNumber` as a Boolean value).

[`extern NSAttributedStringKey const NSAccessibilityBackgroundColorTextAttribute;`](/documentation/AppKit/NSAccessibilityBackgroundColorTextAttribute)

Text background color (`CGColorRef`).

[`extern NSAttributedStringKey const NSAccessibilityCustomTextAttribute;`](/documentation/AppKit/NSAccessibilityCustomTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityFontBoldAttribute;`](/documentation/AppKit/NSAccessibilityFontBoldAttribute)

[`extern NSAttributedStringKey const NSAccessibilityFontItalicAttribute;`](/documentation/AppKit/NSAccessibilityFontItalicAttribute)

[`extern NSAttributedStringKey const NSAccessibilityFontTextAttribute;`](/documentation/AppKit/NSAccessibilityFontTextAttribute)

Font keys (`NSDictionary`).

[`extern NSAttributedStringKey const NSAccessibilityForegroundColorTextAttribute;`](/documentation/AppKit/NSAccessibilityForegroundColorTextAttribute)

Text foreground color (`CGColorRef`).

[`extern NSAttributedStringKey const NSAccessibilityLanguageTextAttribute;`](/documentation/AppKit/NSAccessibilityLanguageTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityLinkTextAttribute;`](/documentation/AppKit/NSAccessibilityLinkTextAttribute)

Text link (`id`).

[`extern NSAttributedStringKey const NSAccessibilityListItemIndexTextAttribute;`](/documentation/AppKit/NSAccessibilityListItemIndexTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityListItemLevelTextAttribute;`](/documentation/AppKit/NSAccessibilityListItemLevelTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityListItemPrefixTextAttribute;`](/documentation/AppKit/NSAccessibilityListItemPrefixTextAttribute)

[`extern NSAttributedStringKey const NSAccessibilityMarkedMisspelledTextAttribute;`](/documentation/AppKit/NSAccessibilityMarkedMisspelledTextAttribute)

Misspelled text that is visibly marked as misspelled (`NSNumber` as a Boolean value). If you’re implementing a custom text-editing app, use `NSAccessibilityMarkedMisspelledTextAttribute` to ensure that VoiceOver properly identifies misspelled text to users.

[`extern NSAttributedStringKey const NSAccessibilityMisspelledTextAttribute;`](/documentation/AppKit/NSAccessibilityMisspelledTextAttribute)

Misspelled text that isn’t necessarily visibly marked as misspelled (`NSNumber` as a Boolean value).

[`extern NSAttributedStringKey const NSAccessibilityShadowTextAttribute;`](/documentation/AppKit/NSAccessibilityShadowTextAttribute)

Text shadow (`NSNumber` as a Boolean value).

[`extern NSAttributedStringKey const NSAccessibilityStrikethroughTextAttribute;`](/documentation/AppKit/NSAccessibilityStrikethroughTextAttribute)

Text strikethrough (`NSNumber` as a Boolean value).

[`extern NSAttributedStringKey const NSAccessibilityStrikethroughColorTextAttribute;`](/documentation/AppKit/NSAccessibilityStrikethroughColorTextAttribute)

Text strikethrough color (`CGColorRef`).

[`extern NSAttributedStringKey const NSAccessibilitySuperscriptTextAttribute;`](/documentation/AppKit/NSAccessibilitySuperscriptTextAttribute)

Text superscript style (`NSNumber`). Values > 0 are superscript; values < 0 are subscript.

[`extern NSAttributedStringKey const NSAccessibilityTextAlignmentAttribute;`](/documentation/AppKit/NSAccessibilityTextAlignmentAttribute)

[`let NSAccessibilityTextCompletionAttribute: String`](/documentation/AppKit/NSAccessibilityTextCompletionAttribute)

[`extern NSAttributedStringKey const NSAccessibilityUnderlineTextAttribute;`](/documentation/AppKit/NSAccessibilityUnderlineTextAttribute)

Text underline style (`NSNumber`).

[`extern NSAttributedStringKey const NSAccessibilityUnderlineColorTextAttribute;`](/documentation/AppKit/NSAccessibilityUnderlineColorTextAttribute)

Text underline color (`CGColorRef`).

### Writing Tools keys

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

### Deprecated keys

[`extern NSAttributedStringKey const NSAccessibilityAttachmentTextAttribute;`](/documentation/AppKit/NSAccessibilityAttachmentTextAttribute)

Text attachment (`id`).

[`extern NSAttributedStringKey NSExpansionAttributeName;`](/documentation/AppKit/NSExpansionAttributeName)

The expansion factor of the text.

[`extern NSAttributedStringKey NSObliquenessAttributeName;`](/documentation/AppKit/NSObliquenessAttributeName)

The obliqueness of the text.

[`extern NSAttributedStringKey NSVerticalGlyphFormAttributeName;`](/documentation/AppKit/NSVerticalGlyphFormAttributeName)

The vertical glyph form of the text.

[`extern NSAttributedStringKey NSCharacterShapeAttributeName;`](/documentation/AppKit/NSCharacterShapeAttributeName)

The character shape attribute.

[`extern NSAttributedStringKey NSUsesScreenFontsDocumentAttribute;`](/documentation/AppKit/NSUsesScreenFontsDocumentAttribute)

The screen fonts attribute.



---

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)