Declaration
compose().toolbarVerticalBehavior(
behavior: SwiftUI.ToolbarVerticalBehavior
)nonisolated func toolbarVerticalBehavior(
_ behavior: ToolbarVerticalBehavior
) -> some ViewParameters
behavior*SwiftUI.ToolbarVerticalBehaviorThe desired behavior for the vertical bar.
Discussion
By default, the system determines whether a vertical bar is rendered
based on the device and application state. Use
ToolbarVerticalBehavior.disabled to opt out of the vertical bar,
causing bar content to fall back to the standard horizontal top and
bottom toolbars.
Disable the vertical bar only for UIs that are better served by
horizontal bars — such as a fullscreen video player with toolbar
controls, or a non-scrolling layout like a calculator where horizontal
space is at a premium. Treat it as a stable choice: avoid changing it
frequently as the user navigates, and don't toggle it for a single view
as a function of that view's state. To hide the bars on a given screen
rather than change the layout, use View.toolbarVisibility(_:for:)
instead.
The behavior is resolved by the window or presentation if placed within a sheet or form. Different containers resolve their overall preferred behavior in different ways:
- A
NavigationStackuses the top most view of its stack of views. - A
TabViewuses the selected view. - A
NavigationSplitViewuses the view in the trailing-most column.
When the value changes, the system animates the transition: content reflows to or from the horizontal bars while the status bar changes axis and the leading or trailing safe area inset for the vertical bar is added or removed.
TabView {
Tab("Home", systemImage: "house") {
HomeView()
}
}
.toolbarVerticalBehavior(.disabled)See also
More in Navigation.
- assistiveAccessNavigationIconConfigures the view's icon for purposes of navigation.
- asyncImageURLSessionA modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.
- contentToolbarPopulates the toolbar of the specified content view type with the views you provide.
- defaultAdaptableTabBarPlacementSpecifies the default placement for the tabs in a tab view using the adaptable sidebar style.
- defaultTabBarPlacementSpecifies the preferred placement for the tabs of a TabView in the TabViewStyle.sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown.
- navigationBarBackButtonHiddenHides the navigation bar back button for the view.
- navigationBarTitleDisplayModeConfigures the title display mode for this view.
- navigationDestinationAssociates a destination view with a presented data type for use within a navigation stack.
- navigationDocumentConfigures the view's document for purposes of navigation.
- navigationLinkIndicatorVisibilityConfigures whether navigation links show a disclosure indicator.
- navigationSplitViewColumnWidthSets a fixed, preferred width for the column containing this view.
- navigationSubtitleConfigures the view's subtitle for purposes of navigation, using a localized string resource.