Compose SwiftUIv0.4.0
esc
GuideAPIGitHub
View modifier

font(_:)

Sets the font of the text in a view.

iOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
fun Modifier.font(font: Font?): Modifier

Overview

Applied to a container, the font applies to every Text inside that doesn't set its own.

Text("Today", modifier = Modifier.font(Font.largeTitle))

This is the Kotlin form of SwiftUI View.font(_:): SwiftUI documentation. In Swift it reads:

nonisolated func font(_ font: Font?) -> some View

Topics

Overloads

fun Modifier.font(font: Font?): Modifier
SwiftUI View.font(_:)