Prefer Vertical Toolbar Items
A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.
Platform Compatibility
iOS 27.1+ iPadOS 27.1+
Tags
SwiftUI Code
TabView {
Tab("A", systemImage: "a.square") {
NavigationStack {
Text("FooBar")
.toolbar {
ToolbarItem {
Button("1", systemImage: "1.circle", action: action)
}
ToolbarItem {
Button("2", systemImage: "2.circle", action: action)
}
ToolbarItem {
Button("3", systemImage: "3.circle", action: action)
}
ToolbarItem {
Button("4", systemImage: "4.circle", action: action)
}
ToolbarItem {
Button("5", systemImage: "5.circle", action: action)
}
}
.toolbarVerticalCompressionBehavior(.prefersToolbarItems)
}
}
Tab("B", systemImage: "b.square") {}
Tab("C", systemImage: "c.square") {}
Tab("D", systemImage: "d.square") {}
Tab("E", systemImage: "e.square") {}
Tab("F", systemImage: "f.square") {}
}Found an issue or have a suggestion?
Created: September 26, 2026Updated: September 26, 2026