How to minimize the tab bar on scroll in SwiftUI
Table of Contents
In iOS 26, the tab bar floats over your content. You can make it shrink when the user scrolls, so they see more of the content.
You do this with tabBarMinimizeBehavior(_:).
How to minimize the tab bar
Add tabBarMinimizeBehavior(_:) to your TabView.
TabView {
Tab("Home", systemImage: "house.fill") {
HomeView()
}
Tab("Library", systemImage: "books.vertical.fill") {
LibraryView()
}
Tab("Profile", systemImage: "person.crop.circle") {
ProfileView()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
With .onScrollDown, the tab bar shrinks to a small circle when you scroll down. The circle shows the tab you are on.
You can easily support sarunw.com by checking out this sponsor.
Screenshot Studio: Create App Store screenshots in seconds not minutes.
The four options
TabBarMinimizeBehavior has four values.
.automatic: the system decides. This is the same as not using the modifier..onScrollDown: the tab bar shrinks when you scroll down..onScrollUp: the tab bar shrinks when you scroll up. Scrolling down leaves it alone..never: the tab bar never shrinks.
On iPhone, .automatic doesn't shrink the tab bar at all. In my testing, .automatic and .never looked the same: a full tab bar the whole time, even at the end of a long list.
So if you want the tab bar to shrink, you have to ask for it with .onScrollDown or .onScrollUp.
How to show the full tab bar again
After the tab bar shrinks, there are two ways to show the full tab bar again.
- Tap the small circle. This always brings the tab bar back, and you stay on the same tab.
- Flick the other way. With
.onScrollDown, a quick flick up brings it back.
What stays when the tab bar minimizes
The circle on the leading side is always the tab you are on. If you are on Library, you see a Library circle.
Some tabs also stay on screen, on the trailing side:
- A tab with the
.searchrole. - A tab with the
.prominentrole. This is new in iOS 27.
If you have both, the prominent tab wins. The search tab goes away with the rest of the tab bar.
TabView {
// ...
Tab(role: .search) {
SearchView()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
A plain tab doesn't stay. In my testing, a tab called "Search" without the .search role went away with the rest of the tab bar.
A tap on the search circle opens the search tab, and the full tab bar comes back.
This works the same on iOS 26 and iOS 27, with or without .tabViewSearchActivation(.searchTabSelection). The minimized tab bar always shows the search tab as its own circle.
You can easily support sarunw.com by checking out this sponsor.
Screenshot Studio: Create App Store screenshots in seconds not minutes.
Conclusion
- Use
.onScrollDownor.onScrollUpto shrink the tab bar. On iPhone,.automaticdoesn't shrink it. - Tap the small circle, or flick the other way, to get the full tab bar back.
- When the bar shrinks, the tab you are on stays, and so does a
.searchtab or a.prominenttab.
Read more article about SwiftUI, iOS 26, TabView, 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 ShareHow the SwiftUI search tab changed in iOS 27
In iOS 27, a search tab stays inside the tab bar instead of getting its own circle. Learn the one line that brings the circle back and what a tap does.