<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Text/font(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4TextV4fontyAcA4FontVSgF"
  },
  "title" : "font(_:)"
}
-->

# font(_:)

Sets the default font for text in the view.

```
nonisolated func font(_ font: Font?) -> Text
```

## Parameters

`font`

The font to use when displaying this text.

## Return Value

Text that uses the font you specify.

## Discussion

Use `font(_:)` to apply a specific font to an individual
Text View, or all of the text views in a container.

In the example below, the first text field has a font set directly,
while the font applied to the following container applies to all of the
text views inside that container:

```
VStack {
    Text("Font applied to a text view.")
        .font(.largeTitle)

    VStack {
        Text("These two text views have the same font")
        Text("applied to their parent view.")
    }
    .font(.system(size: 16, weight: .light, design: .default))
}
```

![Applying a font to a single text view or a view container](images/com.apple.SwiftUI/SwiftUI-view-font@2x.png)

---

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)