Axis Behavior
The bar axis behavior of the toolbar item.
Platform Compatibility
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?
More Toolbars Components
View allPrefer Vertical Toolbar Items
A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.
Toolbar Overflow Menu
The overflow menu of a toolbar. An overflow menu represents actions that are always placed in the toolbar’s overflow menu, regardless of the toolbar mode, platform, or customizability.
Pinned Toolbar Item Placement
A placement that pins the item to the trailing edge of the toolbar.
ToolbarItem Shared Background Visibility
Controls the visibility of the glass background effect on items in the toolbar. In certain contexts, such as the navigation bar on iOS and the window toolbar on macOS, toolbar items will be given a glass background effect that is shared with other items in the same logical grouping
Explore Other Components
Browse allDefault Collapsed Tab Section
Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.
InsetGroupedListStyle
The list style that describes the behavior and appearance of an inset grouped list.
Hidden Index PageTabViewStyle
A TabViewStyle that displays a paged scrolling TabView with a hidden index.