<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AttributedString/TextAlignment",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation16AttributedStringV8CoreTextE0E9AlignmentO"
  },
  "title" : "AttributedString.TextAlignment"
}
-->

# AttributedString.TextAlignment

The explicit alignment of text within its container.

```
enum TextAlignment
```

## Overview

Alignment defines the horizontal position of each line within its
container.

## Topics

### Enumeration Cases

[`case center`](/documentation/Foundation/AttributedString/TextAlignment/center)

The horizontal center of each line is aligned to the horizontal
center of the container.

[`case left`](/documentation/Foundation/AttributedString/TextAlignment/left)

The left edge of each line is aligned to the left edge of
the container.

[`case right`](/documentation/Foundation/AttributedString/TextAlignment/right)

The right edge of each line is aligned to the right edge of
the container.

## Relationships

### Conforms To

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

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

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

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

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

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

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

---

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)