---
title: "font(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/text/font(_:)"
---

# font(_:)

Sets the default font for text in the view.

## Declaration

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

## Parameters

- `font`: The font to use when displaying this text.

## Mentioned in

Applying custom fonts to text

## Return Value

Return Value Text that uses the font you specify.

## Discussion

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)) }

## See Also

### Choosing a font

- [fontWeight(_:)](swiftui/text/fontweight(_:).md)
- [fontDesign(_:)](swiftui/text/fontdesign(_:).md)
- [fontWidth(_:)](swiftui/text/fontwidth(_:).md)
