The way SwiftUI infers the appropriate text alignment if no value
is explicitly provided.
- Note: ``Text`` tightly wraps its content, so text alignment only
affects how lines are positioned relative to each other. The text as a
whole needs to be positioned at the view level using ``Alignment``.
Members (3)
get · iOS 26.0+
layoutBased
TypeScript
static get layoutBased(): Text_AlignmentStrategy
Swift declaration
static let layoutBased: Text.AlignmentStrategy
The alignment following the environment setting.
This alignment follows the
``EnvironmentValues/multilineTextAlignment`` in the view
hierarchy.
get · iOS 26.0+
writingDirectionBased
TypeScript
static get writingDirectionBased(): Text_AlignmentStrategy
Swift declaration
static let writingDirectionBased: Text.AlignmentStrategy
The alignment following the writing direction of the same paragraph.
When ``EnvironmentValues/multilineTextAlignment`` is
``TextAlignment/leading``, alignment follows the writing direction.
If the value is ``TextAlignment/trailing`` alignment is the opposite
of the writing direction and finally, a ``TextAlignment/center``
value always results in centered alignment.
get · iOS 26.0+
default
TypeScript
static get default(): Text_AlignmentStrategy
Swift declaration
static let `default`: Text.AlignmentStrategy
The default strategy based on the context it is used in.
The default strategy for ``Text`` is ``layoutBased``. UI
components that accept user input, such as ``TextEditor`` and
``TextField``, default to ``writingDirectionBased``.