<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextListElement/init(contents:markerAttributes:textList:children:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextListElement(cm)textListElementWithContents:markerAttributes:textList:childElements:"
  },
  "title" : "init(contents:markerAttributes:textList:children:)"
}
-->

# init(contents:markerAttributes:textList:children:)

Creates a text list element with the list elements, nesting level, and marker attributes you provide.

```
convenience init(contents: NSAttributedString, markerAttributes: [NSAttributedString.Key : Any]? = nil, textList: NSTextList, children: [NSTextListElement]?)
```

## Parameters

`contents`

An <doc://com.apple.documentation/documentation/Foundation/NSAttributedString> that contains the contents of the text list element.

`markerAttributes`

A dictionary of <doc://com.apple.documentation/documentation/Foundation/NSAttributedString/Key> keys and IDs that describe the marker attributes.

`textList`

The [`NSTextList`](/documentation/AppKit/NSTextList) to add elements to.

`children`

An array of [`NSTextListElement`](/documentation/AppKit/NSTextListElement) elements.

---

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)