ToolbarTitleAlignment

A preferred alignment for a navigation bar's title.

StructureiOS 27.2+macOS 27.2+tvOS 27.2+watchOS 27.2+visionOS 27.2+ToolbarTitleAlignment in SwiftUI

Declaration

React
type ToolbarTitleAlignment = 'automatic' | 'center' | 'leading';
Swift
struct ToolbarTitleAlignment

Pass a literal, or build one with SwiftUI.ToolbarTitleAlignment from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Overview

Use values of this type with the View.toolbarTitleAlignment(_:) modifier to override the title alignment the system would use.

NavigationStack {
    ContentView()
        .navigationTitle("Library")
        .toolbarTitleAlignment(.center)
}

To read the alignment the system actually used, see EnvironmentValues.toolbarTitleAlignment.

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Navigation.