How to move a navigation title to the leading edge in SwiftUI

⋅ 6 min read ⋅ SwiftUI iOS 27 Toolbar

Table of Contents

On iPhone, a small (inline) navigation title always sits in the middle of the navigation bar. If you wanted it on the leading side, you had to put your own text in a toolbar item.

In iOS 27.2, SwiftUI adds a modifier for this: toolbarTitleAlignment(_:).

In this article, we will learn how to use it, what each value does, and a few places where it behaves in a way you might not expect.

How to use toolbarTitleAlignment

You apply toolbarTitleAlignment(_:) to the view that sets the title, right next to navigationTitle.

NavigationStack {
List {
// ...
}
.navigationTitle("Inbox")
.navigationBarTitleDisplayMode(.inline)
.toolbarTitleAlignment(.leading)
}

With .leading, the title moves to the leading edge and lines up with the content below it.

Without the modifier, an inline title sits in the center. With .leading, it moves to the leading edge.
Without the modifier, an inline title sits in the center. With .leading, it moves to the leading edge.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Why not put the title in a .navigation toolbar item?

Before iOS 27.2, a common way to get a leading title was to hide the real title and put your own text in a toolbar item with the .navigation placement.

List { ... }
.navigationTitle("")
.toolbar {
ToolbarItem(placement: .navigation) {
Text("Inbox")
.font(.headline)
}
}

On iOS 27.2, this doesn't look like a title. A .navigation item is a toolbar item, not a title, so the system treats it like a button.

  • It gets a glass button bubble around it.
  • It's cut off to "In...". The toolbar gives a non-button view only a small, icon-sized space, and Text shrinks itself to fit the space it's given. A Button("Inbox") grows to fit its text, and so does Text with .fixedSize(), but both are still toolbar items in a bubble.
  • VoiceOver reads it as plain text, not a heading. A real navigation title is a heading.
Text in a .navigation item gets a button bubble and is cut off. With .leading, the real title moves and keeps its full width.
Text in a .navigation item gets a button bubble and is cut off. With .leading, the real title moves and keeps its full width.

toolbarTitleAlignment(.leading) doesn't have these problems, because it moves the real title. You keep everything a title gives you, like the subtitle and large title behavior we will see later.

Use .navigation for what it is made for: buttons, such as a sidebar or close button.

The three alignments

ToolbarTitleAlignment has three values.

  • .automatic: the system decides. This is the same as not using the modifier at all.
  • .leading: the title sits on the leading side.
  • .center: the title sits in the center.

On iPhone and iPad, .automatic gives you a centered title, in both portrait and landscape. So in most cases, .leading is the value you will use.

The one place where .automatic isn't centered is iPhone Duo. We will get to it at the end.

Where to put the modifier

toolbarTitleAlignment works like navigationTitle. You put it on the screen inside the navigation stack, not on the stack itself.

// ✅ Works
NavigationStack {
InboxView()
.navigationTitle("Inbox")
.toolbarTitleAlignment(.leading)
}
// ❌ No effect
NavigationStack {
InboxView()
.navigationTitle("Inbox")
}
.toolbarTitleAlignment(.leading)

In my testing, the second version leaves the title in the center.

Each screen also sets its own alignment. If you push a new screen from a screen with .leading, the new screen's title is back in the center. You need to add the modifier to every screen that should have a leading title.

With toolbar buttons

A trailing button doesn't change anything. The title stays on the leading edge, and the button stays on the trailing edge.

When you have a leading button, the title doesn't go under it. It sits right after the leading button.

With a leading button, a .leading title sits right after it.
With a leading button, a .leading title sits right after it.

If your title is long enough to fill the space between the buttons, .leading and .center end up looking almost the same, since there is no room left to move the title.

With a subtitle

If you use navigationSubtitle, the subtitle follows the title. With .leading, both lines move to the leading edge.

The title and subtitle move together.
The title and subtitle move together.

With a custom title view

You might replace the title with your own view using the .principal placement.

List { ... }
.toolbar {
ToolbarItem(placement: .principal) {
Label("Inbox", systemImage: "tray")
.labelStyle(.titleAndIcon)
.font(.headline)
}
}
.navigationBarTitleDisplayMode(.inline)
.toolbarTitleAlignment(.leading)

The modifier moves this view too. With .leading, the custom view sits on the leading edge, just like a plain title.

A custom title view in the .principal placement moves to the leading edge with .leading.
A custom title view in the .principal placement moves to the leading edge with .leading.

With large titles

A large title is always on the leading side, so the modifier doesn't change how it looks at first.

The difference shows up when you scroll. The large title collapses into a small inline title, and the modifier decides where that small title goes.

  • With .center, the small title moves to the center when the large title collapses.
  • With .leading, it stays on the leading side, so the title doesn't jump from one side to the other as you scroll.
After scrolling, the collapsed title goes to the center with .center and stays on the leading side with .leading.
After scrolling, the collapsed title goes to the center with .center and stays on the leading side with .leading.

iPhone Duo

On iPhone Duo, when the device is unfolded and the app is in landscape, toolbar items move from the top of the screen to a vertical bar on the side. I covered this in Opt in to vertical bars on iPhone Duo.

In this layout, .automatic puts the title on the leading side. This is the only place in my testing where the default title isn't centered.

If you want a centered title here, use .center.

On iPhone Duo unfolded in landscape, the default title is on the leading side (top). With .center, it moves to the middle (bottom).
On iPhone Duo unfolded in landscape, the default title is on the leading side (top). With .center, it moves to the middle (bottom).

When I rotate the unfolded device to portrait, the toolbar goes back to the top, and the default title is centered again.

This is why you might prefer .automatic over .center when you don't have a strong opinion. It lets the system pick the right spot for each layout.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Conclusion

toolbarTitleAlignment(_:) is a small modifier, but it replaces a common workaround.

  • Use .leading to put a title on the leading edge.
  • Put the modifier on each screen, next to navigationTitle, not on the NavigationStack.
  • It moves the subtitle and a .principal view too.
  • For large titles, it decides where the collapsed title goes.
  • .automatic is centered on iPhone and iPad, but leading on an unfolded iPhone Duo in landscape.

All my testing was on the iOS 27.2 simulator: iPhone 18 Pro, iPad Pro 11-inch, and iPhone Duo.

If you want to see where toolbar items go, check out Toolbar item placements in SwiftUI.


Read more article about SwiftUI, iOS 27, Toolbar, or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

I also make short videos and visual guides on Patreon. Some things are easier to see than to read, like how an API looks and moves on a real screen. If you like to learn that way, come and watch. Sharing the article is also greatly appreciated.

Become a patron Tweet Share
Previous
What is GlassEffectContainer in SwiftUI and how to use it

Learn what GlassEffectContainer does, why Liquid Glass shapes need it, and how to blend, merge, and animate glass views with spacing, glassEffectUnion, glassEffectID, and glassEffectTransition.

← Home