<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.10.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSForm/setTextAlignment(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSForm(im)setTextAlignment:"
  },
  "title" : "setTextAlignment(_:)"
}
-->

# setTextAlignment(_:)

Sets the alignment for all of the receiver’s editable text.

```
func setTextAlignment(_ mode: NSTextAlignment)
```

## Parameters

`mode`

The alignment can be one of the following constants: `NSRightTextAlignment`, `NSCenterTextAlignment`, or `NSLeftTextAlignment`.

## Discussion

The default alignment is `NSLeftTextAlignment`.

---

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)