---
title: "init(labelWithAttributedString:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nstextfield/init(labelwithattributedstring:)"
---

# init(labelWithAttributedString:)

Creates a text field for use as a static label that displays styled text, doesn’t wrap, and doesn’t have selectable text.

## Declaration

```swift
convenience init(labelWithAttributedString attributedStringValue: NSAttributedString)
```

## Parameters

- `attributedStringValue`: An attributed string to use as the content of the label.

## Return Value

Return Value A text field that displays the specified attributed string as a static label.

## Discussion

Discussion The text field determines its line-break mode by inspecting the paragraph style attributes in the attributed string. note: When the text field has an attributed string value, the system ignores the textColor, font, alignment, lineBreakMode, and lineBreakStrategy properties. Set the foregroundColor, font, alignment, linebreakmode, and lineBreakStrategy properties in the attributed string instead.

## See Also

### Creating Text Fields

- [init(labelWithString:)](appkit/nstextfield/init(labelwithstring:).md)
- [init(string:)](appkit/nstextfield/init(string:).md)
- [init(wrappingLabelWithString:)](appkit/nstextfield/init(wrappinglabelwithstring:).md)
