Skip to main content
Sets the dynamic type size for text rendering and accessibility. This modifier adjusts your component’s text sizing in accordance with user settings or platform guidelines.
Text("Hello World").dynamicTypeSize("large")

Parameters

size
DynamicTypeSize
The dynamic type size to apply.

Support

Usage

Basic dynamic type size

Text("Accessible text content")
  .dynamicTypeSize("large")

Accessibility-friendly text

Text("Important accessibility information")
  .dynamicTypeSize("accessibility2")
  .multilineTextAlignment("leading")

Combining with other text modifiers

Text("Large title with custom formatting")
  .dynamicTypeSize("xxLarge")
  .fontWeight("bold")
  .foregroundStyle(Color("primary"))

Notes

  • Dynamic type sizes enable your UI to remain readable and flexible across a spectrum of display needs
  • The default dynamic type size is "large" when not specified
  • Accessibility sizes (accessibility1 through accessibility5) provide enhanced text sizing for users with visual impairments
  • This modifier works in conjunction with other text styling modifiers like font() and fontWeight()