<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextElement",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextElement"
  },
  "title" : "NSTextElement"
}
-->

# NSTextElement

An abstract base class that represents the smallest units of text layout such as paragraphs or attachments.

```
class NSTextElement
```

## Topics

### Creating a text element

[`-  initWithTextContentManager:`](/documentation/AppKit/NSTextElement/init(textContentManager:))

Creates a new text element with the content manager you provide.

### Accessing the content manager

[`textContentManager`](/documentation/AppKit/NSTextElement/textContentManager)

The value that represents the current content manager.

### Accessing the text element range

[`elementRange`](/documentation/AppKit/NSTextElement/elementRange)

A range value that represents the range of the element inside the document.

### Accessing text elements

[`isRepresentedElement`](/documentation/AppKit/NSTextElement/isRepresentedElement)

A Boolean value that indicates whether this element is in the text layout.

[`parentElement`](/documentation/AppKit/NSTextElement/parent)

A value that represents the parent element if this text element is a child of an enclosing element.

[`childElements`](/documentation/AppKit/NSTextElement/childElements)

An array of zero or more child text elements.

## Relationships

### Inherited By

[`NSTextParagraph`](/documentation/AppKit/NSTextParagraph)

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)