Contents

toolbarVerticalBehavior(_:)

Sets the behavior for the vertical bar.

Declaration

nonisolated func toolbarVerticalBehavior(_ behavior: ToolbarVerticalBehavior) -> some View

Parameters

  • behavior:

    The 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 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 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

Configuring vertical toolbar behavior