toolbarVerticalBehavior

Sets the behavior for the vertical bar.

View ModifieriOS 27.1+macOS 27.1+tvOS 27.1+watchOS 27.1+visionOS 27.1+toolbarVerticalBehavior(_:) in SwiftUI

Declaration

React
compose().toolbarVerticalBehavior(
  behavior: SwiftUI.ToolbarVerticalBehavior
)
Swift
nonisolated func toolbarVerticalBehavior(
    _ behavior: ToolbarVerticalBehavior
) -> some View

Parameters

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:

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.