Axis Behavior
The bar axis behavior of the toolbar item.
Platform Compatibility
iOS 27.1+ iPadOS 27.1+
Tags
SwiftUI Code
NavigationStack {
Text("FooBar")
.toolbar {
ToolbarItem {
Button(role: .confirm, action: action)
}
ToolbarItem {
Button(role: .cancel, action: action)
}
.axisBehavior(.horizontalOnly)
ToolbarItem {
Button("Foo", action: action)
}
ToolbarItem {
Button("Bar", action: action)
}
.axisBehavior(.verticalPreferred)
}
}Found an issue or have a suggestion?
Created: September 24, 2026Updated: September 24, 2026